protected static final String underbarStringToSentence ( String str ) { if ( str == null ) { return null ; } char [ ] buf = new char [ str . length ( ) ] ; // preserve case of first character buf [ 0 ] = str . charAt ( 0 ) ; for ( int i = 1 ; i < str . length ( ) ; i ++ ) { char c = str . charAt ( i ) ; if ( c >= ' ' && c <= ' ' ) { c += 0x20 ; } else if ( c == 0x5f ) { // convert underbar to space c = 0x20 ; } buf [ i ] = c ; } return new String ( buf ) ; }
Turn FOO_BAR_BAZ into Foo bar baz .