Reputation: 33
I'm trying to get a substring from an initial string in Smalltalk. I'm wondering if there's a way to do it. For example in Java, the method aStringObject.substring(index), allows you to trim a String object using an index (or its position in the array). I've been looking in the browser for something that works in a similar way, but couldn't find it. So far every trimming method uses a character or string to do the separation.
As an example of what I'm looking for:
initialString:='Hello'.
finalString:=initialString substring: 1
The value of finalString should be 'ello'.
Upvotes: 3
Views: 635
Reputation: 176
In Smalltalk a String is a type of SequencableCollection so you can use the copying protocol messages as well.
For example you could use:
Upvotes: 7