[Newbies] [Q] How should one concatenate Strings?

Charles D Hixson charleshixsn at earthlink.net
Sun May 7 05:15:25 UTC 2006


Example:
repr
    "return a representation of THIS object"
    |ic|
    ic := self class.
   ^(#('<!' (self class) ';'  name, '!>') asString).

Unfortunately, not only is this clunky, it returns a string array rather
than a character string.  (Forgive any typos...I wanted a sensible
example, but the reality was tested in the workspace.)

What I want is to just return a character string built from other
character strings, some of which may be computer and other of which
might be literal.

For example, what I might want returned could be the string
'<!Android;Marvin!>'.

The only way I've been able to figure out how to do this is to create a
sufficiently long string (after calculating the length of each piece)
and then to use at:put:



More information about the Beginners mailing list