<HTML>
<HEAD>
<TITLE>Re: findTokens: vs explode:</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:14.0px'>Ron Teitelbaum puso en su mail :<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Arial"><SPAN STYLE='font-size:15.0px'>Hi all,<BR>
<BR>
Earlier we discussed a replacement for my explode method. findTokens: was suggested but <BR>
<BR>
' version [0] EXPLICIT Version DEFAULT v1,' findTokens: ‘EXPLICIT’ = <BR>
an OrderedCollection(' version [0] ' ' Version D' 'FAU' ' v1,')<BR>
<BR>
but <BR>
<BR>
' version [0] EXPLICIT Version DEFAULT v1,' explode: ‘EXPLICIT’ = <BR>
an OrderedCollection(' version [0] ' ' Version DEFAULT v1,')<BR>
<BR>
I can see that findTokens: removes all instances of each character. Which is not what I’m looking for.<BR>
<BR>
Does anyone have any other suggestions?<BR>
<BR>
Ron Teitelbaum <BR>
<BR>
Ron:<BR>
Hope this helps, sure someone could do better<BR>
<BR>
In String, accesing category<BR>
<BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Arial"><SPAN STYLE='font-size:15.0px'>explode: aString <BR>
| pos tokens |<BR>
tokens := OrderedCollection new.<BR>
pos := self findString: aString startingAt: 1.<BR>
tokens<BR>
add: (self copyFrom: 1 to: pos - 1).<BR>
pos := pos + aString size.<BR>
tokens<BR>
add: (self copyFrom: pos to: self size).<BR>
^ tokens<BR>
<BR>
</SPAN></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:14.0px'>' version [0] EXPLICIT Version DEFAULT v1,' explode: 'EXPLICIT' an OrderedCollection(' version [0] ' ' Version DEFAULT v1,')<BR>
<BR>
I note what copy from yours and paste again in Squeak the delimiters of EXPLICIT was different to single quote<BR>
<BR>
Edgar</SPAN></FONT>
</BODY>
</HTML>