static String cssContent ( String token ) { int n = token . length ( ) ; int pos = 0 ; StringBuilder sb = null ; if ( n >= 2 ) { char ch0 = token . charAt ( 0 ) ; if ( ch0 == ' ' || ch0 == ' ' ) { if ( ch0 == token . charAt ( n - 1 ) ) { pos = 1 ; -- n ; sb = new StringBuilder ( n ) ; } } } for ( int esc ; ( esc = token . indexOf ( ' ' , pos ) ) >= 0 ; ) { int end = esc + 2 ; if ( esc > n ) { break ; } if ( sb == null ) { sb = new StringBuilder ( n ) ; } sb . append ( token , pos , esc ) ; int codepoint = token . charAt ( end - 1 ) ; if ( isHex ( codepoint ) ) { // Parse \hhhhh<opt-break> where hhhhh is one or more hex digits // and <opt-break> is an optional space or tab character that can be // used to separate an escape sequence from a following literal hex // digit. while ( end < n && isHex ( token . charAt ( end ) ) ) { ++ end ; } try { codepoint = Integer . parseInt ( token . substring ( esc + 1 , end ) , 16 ) ; } catch ( RuntimeException ex ) { ignore ( ex ) ; codepoint = 0xfffd ; // Unknown codepoint. } if ( end < n ) { char ch = token . charAt ( end ) ; if ( ch == ' ' || ch == ' ' ) { // Ignorable hex follower. ++ end ; } } } sb . appendCodePoint ( codepoint ) ; pos = end ; } if ( sb == null ) { return token ; } return sb . append ( token , pos , n ) . toString ( ) ; }
Decodes any escape sequences and strips any quotes from the input .