Shop OBEX P1 Docs P2 Docs Learn Events
String Concatenation — Parallax Forums

String Concatenation

PhilldapillPhilldapill Posts: 1,283
edited 2009-05-26 01:35 in Propeller 1
Is there any way to concatenate strings/integers? I'm writing some code that writes to an SD Card, and I have a feeling that I could write the data a whole lot faster if I first concatenate all the bits of data into a string, then write that string at once.

Anyway to squash integers, strings, and individual characters together into a single string?

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-26 00:20
    My string object may help, but it comes with some heavy baggage in the form of a dynamic memory manager.

    -Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-26 01:35
    You can use BYTEMOVE along with STRSIZE to catenate strings as long as you have an area allocated to receive it. You do have to first convert numbers and single characters into strings:

    bytemove(resultString + strsize(resultString),newString,strsize(newString)+1)

    This copies a 2nd string (newString) onto the end of the 1st string's value (resultString). If you happen to have the lengths of the 2 strings, you can save some time by using those rather than getting it with each move.
Sign In or Register to comment.