Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4308386

RFE: Add 'replace(String old, String new)' to StringBuffer

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.3.0
    • core-libs
    • generic
    • generic



      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)
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: