Here you can find the source of unescapeString(String s, char enclosed)
public static String unescapeString(String s, char enclosed)
//package com.java2s; /*/*from w w w .j a v a 2 s . c om*/ * QCRI, NADEEF LICENSE * NADEEF is an extensible, generalized and easy-to-deploy data cleaning platform built at QCRI. * NADEEF means "Clean" in Arabic * * Copyright (c) 2011-2013, Qatar Foundation for Education, Science and Community Development (on * behalf of Qatar Computing Research Institute) having its principle place of business in Doha, * Qatar with the registered address P.O box 5825 Doha, Qatar (hereinafter referred to as "QCRI") * * NADEEF has patent pending nevertheless the following is granted. * NADEEF is released under the terms of the MIT License, (http://opensource.org/licenses/MIT). */ public class Main { public static String unescapeString(String s, char enclosed) { // return unchanged when the string is not enclosed. if (s.charAt(0) != enclosed) return s; String reg = "\\\\" + enclosed; String replaced = s.replaceAll(reg, Character.toString(enclosed)); return replaced.substring(1, replaced.length() - 1); } }