public static String javaScriptUnescape(String s){
  StringBuilder sb=new StringBuilder(s.length());
  for (int i=0; i < s.length(); ) {
    char c=s.charAt(i);
    if (c == '\\') {
      i=javaScriptUnescapeHelper(s,i + 1,sb);
    }
 else {
      sb.append(c);
      i++;
    }
  }
  return sb.toString();
}

public static String javaScriptUnescape ( String s ) { StringBuilder sb = new StringBuilder ( s . length ( ) ) ; for ( int i = 0 ; i < s . length ( ) ; ) { char c = s . charAt ( i ) ; if ( c == '\\' ) { i = javaScriptUnescapeHelper ( s , i + 1 , sb ) ; } else { sb . append ( c ) ; i ++ ; } } return sb . toString ( ) ; }
undo escaping as performed in javascriptescape ( . ) throws an illegalargumentexception if the string contains bad escaping .
