public static String hyphenToCamelCase ( String hyphenStr ) { if ( hyphenStr == null || hyphenStr . isEmpty ( ) ) return hyphenStr ; int p = hyphenStr . indexOf ( ' ' ) ; if ( p == - 1 ) return hyphenStr ; StringBuilder sb = new StringBuilder ( hyphenStr ) ; do { int i = p + 1 ; if ( i < sb . length ( ) ) { sb . setCharAt ( i , Character . toUpperCase ( sb . charAt ( i ) ) ) ; } sb . deleteCharAt ( p ) ; p = sb . indexOf ( "-" , p ) ; if ( p == - 1 ) break ; } while ( true ) ; return sb . toString ( ) ; }
Converts aaa - bbb - ccc to aaaBbbCcc