A DESCRIPTION OF THE REQUEST :
Such a method would convert the first code point of the string to title case.
Surely such a routine is being used in all sorts of applications. A naïve approach might be:
public String toTitleCase() {
if (length() == 0) return this;
char firstChar = charAt(0);
firstChar = Character.toTitleCase(firstChar);
return firstChar + substring(1);
}
Even this method seems non-trivial and used often enough to warrant adding to the API. However this method doesn't take into account code points and locales. Surely these complexities are enough to warrant an addition to the API.
JUSTIFICATION :
Such an operation seems non-trivial to me, especially given that the first code point may be made up of more than one character.
Such a method would convert the first code point of the string to title case.
Surely such a routine is being used in all sorts of applications. A naïve approach might be:
public String toTitleCase() {
if (length() == 0) return this;
char firstChar = charAt(0);
firstChar = Character.toTitleCase(firstChar);
return firstChar + substring(1);
}
Even this method seems non-trivial and used often enough to warrant adding to the API. However this method doesn't take into account code points and locales. Surely these complexities are enough to warrant an addition to the API.
JUSTIFICATION :
Such an operation seems non-trivial to me, especially given that the first code point may be made up of more than one character.
- relates to
-
JDK-4383205 toTitleCase() on String class
-
- Closed
-