public UTF8String toTitleCase ( ) { if ( numBytes == 0 ) { return EMPTY_UTF8 ; } byte [ ] bytes = new byte [ numBytes ] ; for ( int i = 0 ; i < numBytes ; i ++ ) { byte b = getByte ( i ) ; if ( i == 0 || getByte ( i - 1 ) == ' ' ) { if ( numBytesForFirstByte ( b ) != 1 ) { // fallback return toTitleCaseSlow ( ) ; } int upper = Character . toTitleCase ( b ) ; if ( upper > 127 ) { // fallback return toTitleCaseSlow ( ) ; } bytes [ i ] = ( byte ) upper ; } else { bytes [ i ] = b ; } } return fromBytes ( bytes ) ; }
Returns the title case of this string that could be used as title .