Java Utililty Methods String Capitalize

List of utility methods to do String Capitalize

Description

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

Method

StringcapitalizeFirst(CharSequence str)
Capitalizes the first character (if existent) in the given character sequence, and returns the result.
if (str.length() == 0) {
    return "";
StringBuilder sb = new StringBuilder(str.length());
sb.append(str.charAt(0));
sb.append(str.subSequence(1, str.length()));
return sb.toString();
StringcapitalizeFormat(String string)
capitalize Format
final char ac[] = string.replace("_", " ").toCharArray();
if ((ac[0] >= 'a') && (ac[0] <= 'z')) {
    ac[0] = (char) ((ac[0] + 65) - 97);
return new String(ac);
StringcapitalizeFront(String str)
Capitalizes the first letter of str.
str = str.toLowerCase();
char front = str.charAt(0);
str.replaceFirst(String.valueOf(front), String.valueOf(front).toUpperCase());
return str;
StringcapitalizeHeadingCharacter(final String value)
capitalize Heading Character
return value.length() > 0 ? Character.toUpperCase(value.charAt(0)) + value.substring(1) : value;
StringcapitalizeInitial(String str)
capitalize Initial
if (str == null || "".equals(str)) {
    return str;
char[] chars = str.toCharArray();
chars[0] = Character.toUpperCase(chars[0]);
return new String(chars);
StringcapitalizeMessage(String message)
capitalize Message
return message.substring(0, 1) + message.substring(1).toLowerCase();
StringcapitalizeMethodName(String methodName)
This method capitalized the first character of methodName.
assert (methodName != null);
return methodName = methodName.substring(0, 1).toUpperCase() + methodName.substring(1);
StringcapitalizeName(final String name)
capitalize Name
return Character.toUpperCase(name.charAt(0)) + name.substring(1);
StringcapitalizeName(String name)
Capitalizes the first word of the supplied name, preserves the case of subsequent words and lower cases all other letters.
StringBuilder cname = new StringBuilder();
boolean wasSpace = false;
for (int ii = 0, ll = name.length(); ii < ll; ii++) {
    char c = name.charAt(ii);
    if (ii == 0) {
        cname.append(Character.toUpperCase(c));
    } else if (wasSpace) {
        cname.append(c);
...
StringcapitalizePackageName(final String packageName)
capitalize Package Name
String s = packageName;
if (packageName != null) {
    String[] ss = packageName.replaceAll("-", ".").split("\\.");
    StringBuffer sb = new StringBuffer(packageName.length());
    for (String sx : ss) {
        if (sx.length() > 0) {
            sb.append(sx.substring(0, 1).toUpperCase());
            if (sx.length() > 1) {
...