static public String uncapitalize ( String string0 ) { if ( string0 == null ) { return null ; } int length = string0 . length ( ) ; // if empty string, just return it if ( length == 0 ) { return string0 ; } else if ( length == 1 ) { return string0 . toLowerCase ( ) ; } else { StringBuilder buf = new StringBuilder ( length ) ; buf . append ( string0 . substring ( 0 , 1 ) . toLowerCase ( ) ) ; buf . append ( string0 . substring ( 1 ) ) ; return buf . toString ( ) ; } }
Safely uncapitalizes a string by converting the first character to lower case . Handles null empty and strings of length of 1 or greater . For example this will convert Joe to joe . If the string is null this will return null . If the string is empty such as then it ll just return an empty string such as .