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

Add String.remove method

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      At the moment java doesn't have a String.remove method. That confuses people a lot:

      https://stackoverflow.com/questions/4576352/remove-all-occurrences-of-char-from-string
      https://stackoverflow.com/questions/5695623/remove-characters-from-a-string-in-java
      https://stackoverflow.com/questions/8694984/remove-part-of-string-in-java
      https://stackoverflow.com/questions/7775364/how-can-i-remove-a-substring-from-a-given-string

      Right now it is possible to do so with String.repalce(string, string). But it is not that effective as it could be, especially for the cases with a single char like this:

      .replace(".", "")

      for example replace(char, char) outperforms replace(string, string) for the single character by four times.

      JDK itself uses this code pattern a lot, so it could be improved as well.


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: