Daniel,
On Mar 29, 2005, at 6:17 PM, Daniel Salama wrote:
Is there an easy way to do search and replace within a string.
For example, give: 'this is foo test' to replace foo with bar and end up with: 'this is bar test'?
Thanks, Daniel
P.S. Sorry for the simple question but I just can't find the answer. I would assume there is an easy way of doing this other than involving "complicated" logic using String#replaceFrom
I didn't know the answer, either. However, I do know about the Method Finder. (World Menu -> open... -> Method Finder). I opened that and in the top left pane, I typed
'this is foo test'. 'foo'. 'bar'. 'this is bar test'
and hit enter. It found
SequencableCollection>>copyReplaceAll:with: String>>copyReplaceAll:with: Text>>copyReplaceTokens:with:
So, 'this is foo test' copyReplaceAll: 'foo' with: 'bar' does what you want.
Jim