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

StringBuffer should contain a replace method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.2, 1.1.3, 1.1.4, 1.2.0
    • core-libs
    • None
    • x86
    • windows_95, windows_nt



      Name: joT67522 Date: 09/05/97


      There is no way to easily change a character or a string within
      a StringBuffer, but it would be vastly easier to add one than
      to force everyone to do multiple convert to character string
      and then append to accoplish the same task.

      There are two basic types of replace, one which changes the
      length of the string and the other that doesn't, each requires
      their own methods under the general replace name.

      Methods that do not change StringBuffer length.

      StringBuffer.replace(int, char) - replaces charAt int with char
      StringBuffer.replace(int, String) - replaces the characters
                   starting at int with String

      Note: one must consider if int + String.length exceeds
      the current length of the StringBuffer whether this is an error
      or not.

      Methods that do change StringBuffer length

      StringBuffer.replace(int1, int2, String) - replaces the int2
                   characters starting at int1 with String

      Note: This is esentialy a delete followed by an insert.

      company - Cash Markets Group , email - ###@###.###
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            johsunw Joon Oh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: