public static String snakeCaseToCamelCase ( String snakeCase ) { if ( snakeCase . contains ( "-" ) ) { StringBuilder camelCaseStr = new StringBuilder ( snakeCase . length ( ) ) ; boolean toUpperCase = false ; for ( char c : snakeCase . toCharArray ( ) ) { if ( c == ' ' ) toUpperCase = true ; else { if ( toUpperCase ) { toUpperCase = false ; c = Character . toUpperCase ( c ) ; } camelCaseStr . append ( c ) ; } } snakeCase = camelCaseStr . toString ( ) ; } return snakeCase ; }
Transform a snake - case string to a camel - case one .