<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>
&nbsp;<BR>
Earlier we discussed a replacement for my explode method. &nbsp;findTokens: was suggested but <BR>
&nbsp;<BR>
' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0] &nbsp;EXPLICIT Version DEFAULT v1,' findTokens: &#8216;EXPLICIT&#8217; &nbsp;= <BR>
an OrderedCollection(' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0] &nbsp;' ' Version D' 'FAU' ' v1,')<BR>
&nbsp;<BR>
but <BR>
&nbsp;<BR>
' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0] &nbsp;EXPLICIT Version DEFAULT v1,' explode: &#8216;EXPLICIT&#8217; = <BR>
an OrderedCollection(' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0] &nbsp;' ' Version DEFAULT v1,')<BR>
&nbsp;<BR>
I can see that findTokens: removes all instances of each character. &nbsp;Which is not what I&#8217;m looking for.<BR>
&nbsp;<BR>
Does anyone have any other suggestions?<BR>
&nbsp;<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>
&nbsp;&nbsp;&nbsp;&nbsp;| pos tokens |<BR>
&nbsp;&nbsp;&nbsp;&nbsp;tokens := OrderedCollection new.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;pos := self findString: aString startingAt: 1.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;tokens<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;add: (self copyFrom: 1 to: pos - 1).<BR>
&nbsp;&nbsp;&nbsp;&nbsp;pos := pos + aString size.<BR>
&nbsp;&nbsp;&nbsp;&nbsp;tokens<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;add: (self copyFrom: pos to: self size).<BR>
&nbsp;&nbsp;&nbsp;&nbsp;^ tokens<BR>
<BR>
</SPAN></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:14.0px'>' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0] &nbsp;EXPLICIT Version DEFAULT v1,' explode: 'EXPLICIT' an OrderedCollection(' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[0] &nbsp;' ' 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>