-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
8u66
-
generic
-
generic
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.
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.