Here you can find the source of unescape(String line)
public static String unescape(String line)
//package com.java2s; //License from project: Apache License public class Main { public static String unescape(String line) { if (line == null) { return null; }//from w ww. ja v a 2 s .c om StringBuffer sb = new StringBuffer(); for (int i = 0, n = line.length(); i < n; i++) { char c = line.charAt(i); if (c == '\\') { if (i == n - 1) { throw new IllegalArgumentException("Invalid string to unescape:" + line); } char d = line.charAt(i + 1); switch (d) { 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; default: throw new IllegalArgumentException("Invalid string to unescape:" + line); } i++; } else { sb.append(c); } } return new String(sb); } }