Hi!

Does anyone have a good string concatenation routine that they could share? I've been racking my brain for the past couple of hours but haven't come up with one :/

I need one that would e.g. take this string: "ARTYFLKIOXNM" and add the 5th letter to the end of e.g Str1N.

Thanks!
Always think "data" and not "objects". Basically, all you need to do is copy your string somewhere (like in L1) then add whatever you want at the end of your new data. Don't forget about the zero to terminate your string.
Same, if you think "data", you'll guess that you won't manage to put your new string "in" Str1N (which would be said properly as "you won't manage to get Str1N to point to your new string"), or you'd have to let free space after your original string to insert characters after it.

Try this for example:

Code:

"ARTYFLKIOXNM"->Str1

ClrHome

Text(0,,Str1)

Copy(Str1,L1,12)
{Str1+4}->{L1+12}
0->{L1+13}
Text(0,6,L1)
Thanks a lot! I understand the approach now, it works perfectly!
Just wondering if you were still wanting to know how to do this in z80 Assembly?
Sure! that'd be useful for when I learn assembly Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement