public static String parseUnicodeIdentifier ( String str , int [ ] pos ) { // assert(pos[0] < str.length()); StringBuilder buf = new StringBuilder ( ) ; int p = pos [ 0 ] ; while ( p < str . length ( ) ) { int ch = Character . codePointAt ( str , p ) ; if ( buf . length ( ) == 0 ) { if ( UCharacter . isUnicodeIdentifierStart ( ch ) ) { buf . appendCodePoint ( ch ) ; } else { return null ; } } else { if ( UCharacter . isUnicodeIdentifierPart ( ch ) ) { buf . appendCodePoint ( ch ) ; } else { break ; } } p += UTF16 . getCharCount ( ch ) ; } pos [ 0 ] = p ; return buf . toString ( ) ; }
Parse a Unicode identifier from the given string at the given position . Return the identifier or null if there is no identifier .