counting tokens in a string

Markus Gaelli gaelli at emergent.de
Tue May 7 08:50:04 UTC 2002


Am Dienstag den, 7. Mai 2002, um 00:39, schrieb Jason Rogers:

> Many thanks.  I knew that Smalltalk should have a better way, it's just
> that I don't know the class libraries well enough to know where to
> look.  In fact, occurrences: was what I really wanted.  I should have
> followed my gut and just typed it. :)
Also, if you knew before, that you would have to add one to the number 
of delimiters
to get the correct number of tokens, and you "only" wondered, how to get 
the number
of delimiters, you could have used the methodfinder:
Just take one and type

'a,b,c,c,,' . $, . 5 (Alt-S)

(reads: which method in String or superclasses of String takes $. as a 
parameter
and gives 5 as a result, if applied to 'a,b,c,c,,')

and it will give you

occurrencesOf:

Best,

Markus




More information about the Squeak-dev mailing list