nisanarz
nisanarz

Reputation: 927

Append two strings

I'm trying to append two string to each other in squeak(version 4.5) and there is no success. For example(what i wish to do):

str1:='hello '.
str2:='world'.
appendStr:= str1 + str2.

There is a way to do that in squeak? (note: the + operator is not necessary- just example)

Thanks a lot, Nisan.

Upvotes: 3

Views: 1459

Answers (1)

Tobias
Tobias

Reputation: 3110

It is possible, you need to use the #, (comma) message like this:

| string1 string2 complete |
string1 := 'Hello '.
string2 := 'World!'.
complete := string1, string2.

Note that in Smalltalk, comma is no syntax but just another message.

Upvotes: 7

Related Questions