String >> #replaceAll:with:

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

String >> #replaceAll:with:

Leandro Caniglia
Some of you may have already noticed that the method in the subject treats the first argument as a pattern. I just realized it last Saturday and would like to hear other opinions. 

The point is that the semantics of the method, as it is, could be a little bit misleading if $* happens to be there. For instance, 'ab*cdefgh' replaceAll: '*' with: '\*' produces '\*'. I consider this misleading in the given context because the receiver and the arguments are Strings and there is no indication in the selector that the first argument will be treated as a pattern. Note also that the comment says nothing about this fact.

Not a big deal, of course, just a matter of curiosity.


*** this signature added by listserv *** *** Visit *** *** for archive browsing and VSWE-L membership management ***