public BinaryString toUpperCase ( ) { if ( javaObject != null ) { return toUpperCaseSlow ( ) ; } if ( sizeInBytes == 0 ) { return EMPTY_UTF8 ; } int size = segments [ 0 ] . size ( ) ; SegmentAndOffset segmentAndOffset = startSegmentAndOffset ( size ) ; byte [ ] bytes = new byte [ sizeInBytes ] ; bytes [ 0 ] = ( byte ) Character . toTitleCase ( segmentAndOffset . value ( ) ) ; for ( int i = 0 ; i < sizeInBytes ; i ++ ) { byte b = segmentAndOffset . value ( ) ; if ( numBytesForFirstByte ( b ) != 1 ) { // fallback return toUpperCaseSlow ( ) ; } int upper = Character . toUpperCase ( ( int ) b ) ; if ( upper > 127 ) { // fallback return toUpperCaseSlow ( ) ; } bytes [ i ] = ( byte ) upper ; segmentAndOffset . nextByte ( size ) ; } return fromBytes ( bytes ) ; }
Returns the upper case of this string .