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

voidcapitalize(StringBuilder text)
capitalize
if (text.length() == 0) {
    return;
text.setCharAt(0, Character.toUpperCase(text.charAt(0)));
voidcapitalizeAt(StringBuilder builder, int index)
Capitalize character at index.
char c = builder.charAt(index);
char capitalized = Character.toUpperCase(c);
if (c != capitalized) {
    builder.setCharAt(index, capitalized);
StringcapitalizeClass(String className)
Capitalizes a full qualified class name.
StringBuilder builder = new StringBuilder(className.length());
int packageIndex = className.lastIndexOf(".");
if (packageIndex != -1) {
    builder.append(className.substring(0, packageIndex + 1));
builder.append(Character.toUpperCase(className.charAt(packageIndex + 1)));
builder.append(className.substring(packageIndex + 2));
className = builder.toString();
...
Stringcapitalized(String s)
capitalized
return s.substring(0, 1).toUpperCase() + s.substring(1);
Stringcapitalized(String s)
capitalized
return isNullOrEmpty(s) ? s : s.substring(0, 1).toUpperCase() + s.substring(1);
Stringcapitalized(String str)
capitalized
if (str == null) {
    return null;
if (str.length() > 0) {
    return str.substring(0, 1).toUpperCase() + str.substring(1);
return str;
StringcapitalizeD(String str, char[] delimiters)
capitalize D
int delimLen = (delimiters == null ? -1 : delimiters.length);
if (str == null || str.length() == 0 || delimLen == 0) {
    return str;
int strLen = str.length();
StringBuilder buffer = new StringBuilder(strLen);
boolean capitalizeNext = true;
for (int i = 0; i < strLen; i++) {
...
String[]capitalizedArray(String[] sstr)
check each word in the given string array is capitalized or not Input: array of strings Output: U U L L U L U L L L U L....
String[] cap = new String[sstr.length];
int i = 0;
for (String s : sstr) {
    if (Character.isUpperCase(s.charAt(0)))
        cap[i] = "U";
    else
        cap[i] = "L";
    i++;
...
StringcapitalizedCase(CharSequence source, char... delimiters)
capitalized Case
int delimitersCount = delimiters == null ? -1 : delimiters.length;
if (isEmpty(source) || delimitersCount == 0) {
    return source.toString();
char[] buffer = source.toString().toLowerCase().toCharArray();
boolean capitalizeNext = true;
for (int i = 0; i < buffer.length; i++) {
    char ch = buffer[i];
...
StringcapitalizedName(final String property)
capitalized Name
if (null == property || property.length() < 1)
    return property;
final char[] chars = property.toCharArray();
chars[0] = Character.toUpperCase(chars[0]);
return new String(chars);