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

(str) Provide a String.split(char) method

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u66
    • Fix Version/s: None
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE REQUEST :
      The existing split() methods take a regex string. Often all that is desired is to split a string around instances of a certain character. A method could be created that directly addresses this simple use case without the overhead of dealing with regular expressions.

      JUSTIFICATION :
      The existing method contains special-case handling for single character regex strings, which suggests the use case is common enough to merit its own implementation.

      As it stands, much of the required implementation exists in the code, but is not externally accessible.

      Being able to explicitly use this functionality within the standard library would be preferable to having it unwittingly reimplemented in third-party code.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Provide additional String.split(char ch) and String.split(char ch, int limit) function overloads that split the string around instances of the provided character.

        Attachments

          Activity

            People

            • Assignee:
              sherman Xueming Shen
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: