Name: krT82822 Date: 01/30/2000
see also 4076965->4120694, 4174396
orig synopsis: "RFE: Add 'replace(String old, String new)' to either 'String' or 'StringBuffer'
java version "1.3beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O)
Java(TM) HotSpot Client VM (build 1.3beta-O, mixed mode)
While the String class offers the convenient 'replace(char oldChar, char
newChar)' method, it seems to lack the even more convenient (and more often
necessary) 'replace(String oldString, String newString)' method.
Since replacing one substring for another substrig is an operation that's used
very often, this seems to be a pretty strange omission.
Thus I'd like to ask for that addition to either the String or the StringBuffer
class. The latter might be the more appropriate place for the actual
implementation while the former probably should have the same method as a
convenience, redirected to
return new StringBuffer(this).replace(oldString, newString).toString();
(Review ID: 100444)
======================================================================