Here you can find the source of unescapeSingleQuoteAndBackslash(String str)
public static String unescapeSingleQuoteAndBackslash(String str)
//package com.java2s; /******************************************************************************* * Copyright (c) 2009-2013 CWI/*from w ww. jav a2 s.c o m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI * * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl *******************************************************************************/ public class Main { public static String unescapeSingleQuoteAndBackslash(String str) { char[] chars = str.toCharArray(); StringBuffer result = new StringBuffer(); for (int i = 0; i < chars.length; i++) { char b = chars[i]; switch (b) { case '\\': switch (chars[++i]) { case '\\': b = '\\'; break; case '\'': b = '\''; break; } } result.append(b); } return result.toString(); } }