Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic (variable length) strings
#1
Hi,

What is the best way of making/using a string as variable length?
I don't know what will be the final size of my target string.

I tried initializing a string s like this,
s = "1234567890"

And then I tried adding extra characters beyond the 10th, e.g., s[11] and s[12]. There was no error, but the extra chars were not saved in the string.

I see there is an insert function. is that the best/only way?
s.insert()

TIA

-avraham
#2
Do you want to add characters to the end?

s+"a" ;;adds character 'a'.
s.formata("%c" 'a') ;;adds character 'a'.
#3
Yes.

So it is a simple concatenate.

Thanks!

-avraham


Forum Jump:


Users browsing this thread: 1 Guest(s)