jodd-core/src/main/java/jodd/util/Format.java
public static String unescapeJava(final String str) {
		char[] chars = str.toCharArray();

		StringBuilder sb = new StringBuilder(str.length());
		for (int i = 0; i < chars.length; i++) {
			char c = chars[i];
			if (c != '\\') {
				sb.append(c);
				continue;
			}
			i++;
			c = chars[i];
			switch (c) {
				case 'b': sb.append('\b'); break;
				case 't': sb.append('\t'); break;
				case 'n': sb.append('\n'); break;
				case 'f': sb.append('\f'); break;
				case 'r': sb.append('\r'); break;
				case '"': sb.append('\"'); break;
				case '\\': sb.append('\\'); break;
				case 'u' :
					char hex = (char) Integer.parseInt(new String(chars, i + 1, 4), 16);
					sb.append(hex);
					i += 4;
					break;
				default:
					throw new IllegalArgumentException("Invalid escaping character: " + c);
			}
		}
		return sb.toString();
	}
public static String unescapeJava(final String str) {
		char[] chars = str.toCharArray();

		StringBuilder sb = new StringBuilder(str.length());
		for (int i = 0; i < chars.length; i++) {
			char c = chars[i];
			if (c != '\\') {
				sb.append(c);
				continue;
			}
			i++;
			c = chars[i];
			switch (c) {
				case 'b': sb.append('\b'); break;
				case 't': sb.append('\t'); break;
				case 'n': sb.append('\n'); break;
				case 'f': sb.append('\f'); break;
				case 'r': sb.append('\r'); break;
				case '"': sb.append('\"'); break;
				case '\\': sb.append('\\'); break;
				case 'u' :
					char hex = (char) Integer.parseInt(new String(chars, i + 1, 4), 16);
					sb.append(hex);
					i += 4;
					break;
				default:
					throw new IllegalArgumentException("Invalid escaping character: " + c);
			}
		}
		return sb.toString();
	}
public static String unescapeJava ( final String str ) { char [ ] chars = str . toCharArray ( ) ; StringBuilder sb = new StringBuilder ( str . length ( ) ) ; for ( int i = 0 ; i < chars . length ; i ++ ) { char c = chars [ i ] ; if ( c != ' ' ) { sb . append ( c ) ; continue ; } i ++ ; c = chars [ i ] ; switch ( c ) { case ' ' : sb . append ( ' ' ) ; break ; case ' ' : sb . append ( ' ' ) ; break ; case ' ' : sb . append ( ' ' ) ; break ; case ' ' : sb . append ( ' ' ) ; break ; case ' ' : sb . append ( ' ' ) ; break ; case ' ' : sb . append ( ' ' ) ; break ; case ' ' : sb . append ( ' ' ) ; break ; case ' ' : char hex = ( char ) Integer . parseInt ( new String ( chars , i + 1 , 4 ) , 16 ) ; sb . append ( hex ) ; i += 4 ; break ; default : throw new IllegalArgumentException ( "Invalid escaping character: " + c ) ; } } return sb . toString ( ) ; }
Unescapes a string using java rules.
Unescapes a string using java rules .