public static String underscoreToCamelCase ( final String undescoredString ) { // Split the string for each underscore final String [ ] parts = undescoredString . split ( CASE_SEPARATOR ) ; final StringBuilder camelCaseString = new StringBuilder ( undescoredString . length ( ) ) ; camelCaseString . append ( parts [ 0 ] . toLowerCase ( Locale . getDefault ( ) ) ) ; // Skip the first part already added for ( int i = 1 ; i < parts . length ; i ++ ) { // First letter to upper case camelCaseString . append ( parts [ i ] . substring ( 0 , 1 ) . toUpperCase ( Locale . getDefault ( ) ) ) ; // Others to lower case camelCaseString . append ( parts [ i ] . substring ( 1 ) . toLowerCase ( Locale . getDefault ( ) ) ) ; } return camelCaseString . toString ( ) ; }
Convert A_STRING_UNDESCORED into aStringUnderscored .