[Newbies] Find and replace
Martial.Boniou at ifrance.com
Sun Dec 30 16:01:52 UTC 2007
string copyReplaceAll: 'you' with 'AA'
Literal strings are mutable by not in length so you can easily do destructive
changes in some special cases where you're sure that length doesn't
change. Thus the following is ok:
string replaceAll: $a with: $b
I think mutable literal strings are a bad thing.
Read the new Squeak bible:
http://www.iam.unibe.ch/~scg/SBE/index.html (especially around pages
an organic a écrit :
| i am new to smalltalk and i look for some easy way to find some substring in
| another string and replace it by another substring:
| example: string := 'Hello how are you? I am fine. Thank you and you?'
| substring to find 'you' replace by 'AA'
| transform to 'Hello how are AAA? I am fine. Thank AAA and AAA?'
| Beginners mailing list
| Beginners at lists.squeakfoundation.org
More information about the Beginners