[Newbies] Collection in Smalltalk
Randal L. Schwartz
merlyn at stonehenge.com
Thu Sep 25 13:40:49 UTC 2008
>>>>> "Herbert" == Herbert König <herbertkoenig at gmx.net> writes:
Herbert> Hello Alex,
AC> Thanks. I'll try to start with the indexing table for each character first.
AC> Anyway do you know how to split string based on more than 1
AC> character, for example I want to split string based on some
AC> punctuation. I have tried using tokenBasedOn, but still can not
AC> figured out how to use it for more than 1 separator.
String> findTokens: is your friend here.
Herbert> I have a code fragment which reads
Herbert> tokens := comment asLowercase findTokens: mySeparators
Herbert> As I use this fairly often, someplace I have code to initialise
Herbert> mySeparators like:
Herbert> mySeparators := Array new: 13
Herbert> mySeparators at: 1 put: $- ; at: 2 put: $( .....
Herbert> and so on.
You can just write that as a literal:
mySeparators := #($- $().
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
More information about the Beginners
mailing list