public static String unformatString(String s){
  StringBuffer result=new StringBuffer();
  int i=0;
  while (i < s.length()) {
    char c=s.charAt(i++);
    if ((c == '\\') && (i < s.length())) {
      c=s.charAt(i++);
      if ((c == 'u') && (i + 3 < s.length())) {
        int value=0;
        for (int j=0; j < 4; j++) {
          c=s.charAt(i++);
          int digit=Character.digit(c,16);
          if (digit != -1) {
            value=(value << 4) + digit;
          }
 else {
            throw new IllegalArgumentException("Malformed \\uxxxx encoding.");
          }
        }
        result.append((char)value);
      }
 else       if (c == 'u') {
        result.append(c);
      }
 else {
        result.append('\\');
        result.append(c);
      }
    }
 else {
      result.append(c);
    }
  }
  return result.toString();
}

public static String unformatString ( String s ) { StringBuffer result = new StringBuffer ( ) ; int i = 0 ; while ( i < s . length ( ) ) { char c = s . charAt ( i ++ ) ; if ( ( c == '\\' ) && ( i < s . length ( ) ) ) { c = s . charAt ( i ++ ) ; if ( ( c == 'u' ) && ( i + 3 < s . length ( ) ) ) { int value = 0 ; for ( int j = 0 ; j < 4 ; j ++ ) { c = s . charAt ( i ++ ) ; int digit = Character . digit ( c , 16 ) ; if ( digit != - 1 ) { value = ( value << 4 ) + digit ; } else { throw new IllegalArgumentException ( "Malformed \\uxxxx encoding." ) ; } } result . append ( ( char ) value ) ; } else if ( c == 'u' ) { result . append ( c ) ; } else { result . append ( '\\' ) ; result . append ( c ) ; } } else { result . append ( c ) ; } } return result . toString ( ) ; }
character unescaping . for example , " \ u0041 - \ u0043 " becomes " a - c " .
