Skip to content

Instantly share code, notes, and snippets.

@jallum
Created February 13, 2014 20:02
Show Gist options
  • Save jallum/8982713 to your computer and use it in GitHub Desktop.
Save jallum/8982713 to your computer and use it in GitHub Desktop.
public static String decapitalize(String name) {
if (name == null || name.length() == 0) {
return name;
}
if (name.length() > 1 && Character.isUpperCase(name.charAt(1)) &&
Character.isUpperCase(name.charAt(0))){
return name;
}
char chars[] = name.toCharArray();
chars[0] = Character.toLowerCase(chars[0]);
return new String(chars);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment