December 22, 2024

Appending a Character to a String

 

In SequenceableCollection you can find:

copyWith: newElement
  "Answer a copy of the receiver that is 1 bigger
  "than the receiver and has newElement at the last element."
    "code omitted"

An example of its use is:

|newString|
newString := 'Endin' copyWith: $g.
^newString "newString references 'Ending'"

« Back to FAQ page

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Up to top of page