Append

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Append

Marius Hovland
I just started using Dolphin smallTalk and can't seem to append a
string to another string. Could anyone help me??


Reply | Threaded
Open this post in threaded view
|

Re: Append

drtau-4
Try:

'abc', 'def'

This will yield the String:  'abcdef'.

Marius Hovland wrote:

> I just started using Dolphin smallTalk and can't seem to append a
> string to another string. Could anyone help me??


Reply | Threaded
Open this post in threaded view
|

Re: Append

Christopher J. Demers
In reply to this post by Marius Hovland
Marius Hovland <[hidden email]> wrote in message
news:[hidden email]...
> I just started using Dolphin smallTalk and can't seem to append a
> string to another string. Could anyone help me??

Try this code:

firstString := 'first'.
secondString := 'second'.
result := firstString , secondString.

This will concatenate the two strings and place the new combined string in
result.  You can think of the comma in Smalltalk as being like a coma in
grammar, for joining.  If you look at the class hierarchy you will see it is
actually implemented in SequenceableCollection, so it is not unique to
strings.  I suppose this message is not easy for a new user to find.  It is
one of those things you just have to know.  And now you know. ;)

Welcome to Dolphin.  I am sure you will find this newsgroup to be a friendly
place to ask questions.

Have fun,
Chris