Java Utililty Methods String Proper Case

List of utility methods to do String Proper Case

  1. HOME
  2. Java
  3. S
  4. String Proper Case

Description

The list of methods to do String Proper Case are organized into topic(s).

Method

String toProperCase(final String s)
Convert to "Proper case" ; capital first letter, lowercase suffix.
return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
String toProperCase(final String string)
to Proper Case
String lowerCase = string.toLowerCase();
lowerCase = lowerCase.substring(1);
String firstCharacter = "" + string.charAt(0);
firstCharacter = firstCharacter.toUpperCase();
return firstCharacter + lowerCase;
String toProperCase(String s)
to Proper Case
return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
String toProperCase(String s)
Convert the String s to proper case.
StringBuilder sb = new StringBuilder();
for (String f : s.split(" ")) {
 if (sb.length() > 0) {
 sb.append(" ");
 sb.append(f.substring(0, 1).toUpperCase()).append(f.substring(1, f.length()).toLowerCase());
return sb.toString();
...
String toProperCase(String s)
To proper case.
return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
String toProperCase(String s)
to Proper Case
if (s.length() == 0) {
 return s;
} else if (s.length() == 1) {
 return s.toUpperCase();
if (s.substring(1).equals(s.substring(1).toUpperCase())) {
 return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
} else {
...
String toProperCase(String text)
to Proper Case
text = text.toLowerCase();
if (text.length() > 1) {
 text = text.substring(0, 1).toUpperCase() + text.substring(1).toLowerCase();
} else {
 text = text.toUpperCase();
return text;
String toProperCase(String text)
to Proper Case
if ((text == null) || (text.length() == 0))
 return text;
else if (text.length() == 1)
 return text.toUpperCase();
else
 return new StringBuilder().append(text.substring(0, 1).toUpperCase()).append(text.substring(1))
 .toString();


AltStyle によって変換されたページ (->オリジナル) /