@ Nonnull public static String unescapeURL ( @ Nonnull final String sEscapedURL ) { int nIndex = sEscapedURL . indexOf ( URL_ESCAPE_CHAR ) ; if ( nIndex < 0 ) { // No escape sequence found return sEscapedURL ; } final StringBuilder aSB = new StringBuilder ( sEscapedURL . length ( ) ) ; int nPrevIndex = 0 ; do { // Append everything before the first quote char aSB . append ( sEscapedURL , nPrevIndex , nIndex ) ; // Append the quoted char itself aSB . append ( sEscapedURL , nIndex + 1 , nIndex + 2 ) ; // The new position to start searching nPrevIndex = nIndex + 2 ; // Search the next escaped char nIndex = sEscapedURL . indexOf ( URL_ESCAPE_CHAR , nPrevIndex ) ; } while ( nIndex >= 0 ) ; // Append the rest aSB . append ( sEscapedURL . substring ( nPrevIndex ) ) ; return aSB . toString ( ) ; }
Unescape all escaped characters in a CSS URL . All characters masked with a \\ character replaced .