MethodFinder
Last updated at 8:34 pm UTC on 29 March 2005
Daniel Salama March 30, 2005 Is there an easy way to do search and replace within a string.For example, given:
'this is foo test'to replace foo with bar and end up with:'this is bar test'?
Jim Menard 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.
Daniel Salama Wow, this is really amazing.You just taught me a new feature of Squeak I didn't know about