Here you can find the source of unquote(String toUnquote, char quoteChar)
Parameter | Description |
---|---|
toUnquote | The String which may contain quoted special characters. |
quoteChar | The quoting character. |
public static String unquote(String toUnquote, char quoteChar)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w ww. ja v a2s . c o m*/ * Unquote special characters. * * @param toUnquote The String which may contain quoted special characters. * @param quoteChar The quoting character. * @return A String with all quoted characters unquoted. */ public static String unquote(String toUnquote, char quoteChar) { StringBuilder result = new StringBuilder(); char c; boolean quoted = false; for (int i = 0; i < toUnquote.length(); ++i) { c = toUnquote.charAt(i); if (quoted) { // append literally... if (c != '\n') { result.append(c); } quoted = false; } else if (c == quoteChar) { // quote char quoted = true; } else { result.append(c); } } return result.toString(); } }