public static String unescapeString(String s) {
        if (s.indexOf('\\') == -1) {
            return s;
        }
        StringBuilder sb = new StringBuilder(s.length());
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (ch == '\\') {
                int j = i + 1;
                if (j < s.length()) {
                    char escCh = s.charAt(j);
                    if (escCh == '\\' || escCh == '\"') {
                        i++;
                        sb.append(escCh);
                    }
                } else {
                    sb.append('\\');
                }
            } else {
                sb.append(ch);
            }
        }
        return sb.toString();
    }
public static String unescapeString ( String s ) { if ( s . indexOf ( '\\' ) == - 1 ) { return s ; } StringBuilder sb = new StringBuilder ( s . length ( ) ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; if ( ch == '\\' ) { int j = i + 1 ; if ( j < s . length ( ) ) { char escCh = s . charAt ( j ) ; if ( escCh == '\\' || escCh == '\"' ) { i ++ ; sb . append ( escCh ) ; } } else { sb . append ( '\\' ) ; } } else { sb . append ( ch ) ; } } return sb . toString ( ) ; }
@param s
string to unescape
@return the unescaped string