Java Utililty Methods String Decapitalize

List of utility methods to do String Decapitalize

Description

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

Method

Stringdecapitalize(String s)
decapitalize
int len = s.length();
if (len == 0)
    return s;
else if (len == 1)
    return Character.toLowerCase(s.charAt(0)) + "";
else
    return Character.toLowerCase(s.charAt(0)) + s.substring(1);
Stringdecapitalize(String s)
Decapitalize a string using java bean conventions.
char[] c = s.toCharArray();
c[0] = toLowerCase(c[0]);
return new String(c);
Stringdecapitalize(String st)
Decapitalize String
if (st.length() == 0)
    return st;
return st.substring(0, 1).toLowerCase() + st.substring(1);
Stringdecapitalize(String str)
decapitalize
if (isEmpty(str))
    return str;
char cs[] = str.toCharArray();
if (cs.length >= 2 && Character.isUpperCase(cs[0]) && Character.isUpperCase(cs[1]))
    return str;
cs[0] = Character.toLowerCase(cs[0]);
return new String(cs);
Stringdecapitalize(String string)
Decapitalize a String if it begins with a capital letter, e.g.: FooBar -> fooBar
char c0 = string.charAt(0);
if (!Character.isUpperCase(c0)) {
    return string;
if (string.length() > 1 && Character.isUpperCase(string.charAt(1))) {
    return string;
char[] chars = string.toCharArray();
...
Stringdecapitalize(String string)
Lowers the first letter of a String.
if (isEmpty(string))
    return (string);
if (string.length() == 1)
    return (string.toLowerCase());
return (string.substring(0, 1).toLowerCase() + string.substring(1, string.length()));
Stringdecapitalize(String string)
Return (possibly copy of) given string with first character lower case.
if (Character.isLowerCase(string.charAt(0)))
    return string;
char chars[] = string.toCharArray();
chars[0] = Character.toLowerCase(chars[0]);
return new String(chars);
Stringdecapitalize(String string)
decapitalize
if (string == null || string.isEmpty()) {
    return string;
String dec = string.substring(0, 1).toLowerCase();
if (string.length() > 1) {
    dec += string.substring(1);
return dec;
...
Stringdecapitalize(String string)
Helper method.
return Character.toLowerCase(string.charAt(0)) + string.substring(1);
Stringdecapitalize(String text)
decapitalize
if (isNullOrEmpty(text)) {
    return text;
char chars[] = text.toCharArray();
chars[0] = Character.toLowerCase(chars[0]);
return new String(chars);