JDK-4214757 : Addtional features to manipulate String and related
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.2.0
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1999-02-24
  • Updated: 2001-11-02
  • Resolved: 2001-11-02
Related Reports
Duplicate :  
Description

Name: dbT83986			Date: 02/24/99


In my preceding mail - dated 4th Nov 98 - I forgot to add, that it would be
very convenient to put all the "is" method(isLetter, isDigit, ...) on class Character,
to the classes String, StringBuffer and StringTokenizer. Simply, instead of having
a char parameter for "is" method in Character, like in Character.isWhiteSpace(char),
one would have the index of the char in the String, StringBuffer or StringTokenizer

To illustrate:
public boolean isWhiteSpace(int index_of_char_in_string)
Which returns true if the character at index index_of_char_in_string is a white space.
public boolean isDigit(int index_of_char_in_string)
public boolean isLetter(int index_of_char_in_string)

But also,
public int indexOfWhiteSpace()
which returns the index of the first white space, if any. Of course, there should exist
public int lastIndexOfWhiteSpace().

In general, string manipulation is rather cubersome in Java, so have a look in C++
Standard Template Library or in Perl to see what are extremely missing features.

Best regards,
       Philippe d'Oreye
(Review ID: 42045)
======================================================================

Comments
EVALUATION The isXXX operations for String are minor conveniences that are probably not worth adding all the extra methods. Being able to scan a string for whitespace, etc. is usefull, but, again, I'm not sure we want to build in all those extra methods. The only reason I'm not closing this is that it might be worth considering some way to scan a string for an instance of a character of a particular class. Also, I've often wanted a regular expression search/match. We might take a look at what we can do to make string handling a little nicer. william.maddox@Eng 1999-02-24 This functionality is provided by java.util.regex. ###@###.### 2001-11-01
24-02-1999