Hi folks,
I just looked for a method to split a string at all occurences of a given character. Unfortunately I couldn't find a method for this problem. So I wrote one myself. Maybe it will be of interest for others.
Frank
Frank Winkler Phaidros Software AG 03677 677 9286 privat Tel. 03677 206615, 0170 821 7624
Java, the best argument for Smalltalk since C++.
Perhaps String>>findTokens: would work? It takes a collection of Characters (e.g., String) as a parameter:
('aloha;bloha;cloha' findTokens: ';') do: [:str | ...]
Bolot
On Thu, Jun 29, 2000 at 01:50:58PM +0200, FWr@phaidros.com wrote:
Hi folks,
I just looked for a method to split a string at all occurences of a given character. Unfortunately I couldn't find a method for this problem. So I wrote one myself. Maybe it will be of interest for others.
Frank
At 10:06 29.06.00 -0400, Bolot Kerimbaev wrote:
Perhaps String>>findTokens: would work? It takes a collection of Characters (e.g., String) as a parameter:
('aloha;bloha;cloha' findTokens: ';') do: [:str | ...]
It not only does what one might want. For example
('aloha;;bloha;cloha' findTokens: ';')
should probably result in a 4-element array, the second element being ''. Frank's method works that way to both methods are useful. (It contains a superfluous #copy, btw, and I'd suggest to rename it to subStrings: which is the ANSI conform name)
bye -- Stefan Matthias Aust // Bevor wir fallen, fallen wir lieber auf
Hi.
I just looked for a method to split a string at all occurences of a given character. Unfortunately I couldn't find a method for this problem. So I wrote one myself. Maybe it will be of interest for others.
I had the same problem yesterday... findTokens: does the work.
Andres.
squeak-dev@lists.squeakfoundation.org