Here you can find the source of unescapeJava(String s)
public static String unescapeJava(String s)
//package com.java2s; //License from project: Open Source License public class Main { /** Turns a printable Java string literal (minus the quotes) into a string. So "\t" is converted to a tab, et cetera. */ public static String unescapeJava(String s) { final int sLength = s.length(); final StringBuilder result = new StringBuilder(sLength); for (int i = 0; i < sLength; ++i) { final char c = s.charAt(i); if (c == '\\' && i < sLength - 1) { char next = s.charAt(++i); if (next == 'n') { result.append('\n'); } else if (next == 'r') { result.append('\r'); } else if (next == 't') { result.append('\t'); } else if (next == 'u') { char actualChar = (char) Integer.parseInt(s.substring(++i, i + 4), 16); i += 3;//from www. j a v a2s . com result.append(actualChar); } else { result.append(next); } } else { result.append(c); } } return result.toString(); } }