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

Add split() variants that keep the delimiters to String and j.u.r.Pattern

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 21
    • 20
    • core-libs
    • b22
    • generic
    • generic

    Description

      Issue JDK-8280101 requests that String.split should keep the delimiter for grouped regex. This is a non-negligible behaviorally incompatible change and would probably break much existing client code.

      A safer alternative is to add API points to both String and Pattern, like
      String.splitWithDelimiters(String regex, int limit);
      Pattern.splitWithDelimiters(CharSequence input, int limit);

      Adding this functionality outside the JDK is somehow more complicated than necessary, so it makes sense to add it in the JDK itself.

      Attachments

        Issue Links

          Activity

            People

              rgiulietti Raffaello Giulietti
              rgiulietti Raffaello Giulietti
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: