Re: String sequence characters and appending clarity
- Posted by mattlewis (admin) Nov 08, 2010
- 1386 views
Anthill said...
I know this is basic but I just need a little clarity on strings. My basic understanding was a string is simply a sequence. Given that, why cant I use append to concatenate two strings?
sequence s, ss s = "Hello " s &= "Fred" --ok puts(1,s) ss = append(s, " Flintstone") --not ok, sequence found inside character string puts(1,ss)
Append adds the second parameter as an element to the end of the first parameter, so you'd have:
s = { 'F', 'r', 'e', 'd', " Flinstone"}
For this operation, you need to use the concatenation operator, '&'.
Matt