QuotedStringTokenizer extends StringTokenizer { public static String unquote(String s) { return unquote(s, false); } QuotedStringTokenizer(String str, String delimiter, boolean returnDelimiters, boolean returnQuotes);  QuotedStringTokenizer(String str, String delimiter, boolean returnDelimiters);  QuotedStringTokenizer(String str, String delimiter);  QuotedStringTokenizer(String str); static String quoteIfNeeded(String s, String delim); static String quote(String s); static void quoteOnly(Appendable buffer, String input); static void quote(Appendable buffer, String input); static String unquoteOnly(String s); static String unquoteOnly(String s, boolean lenient); static String unquote(String s); static String unquote(String s, boolean lenient); static boolean isQuoted(String s); @Override boolean hasMoreTokens(); @Override String nextToken(); @Override String nextToken(String delim); @Override boolean hasMoreElements(); @Override Object nextElement(); @Override int countTokens(); boolean getDouble(); void setDouble(boolean d); boolean getSingle(); void setSingle(boolean single);  }
@Test void testUnquote() { assertEquals("abc", QuotedStringTokenizer.unquote("abc")); assertEquals("a\"c", QuotedStringTokenizer.unquote("\"a\\\"c\"")); assertEquals("a'c", QuotedStringTokenizer.unquote("\"a'c\"")); assertEquals("a\n\r\t", QuotedStringTokenizer.unquote("\"a\\n\\r\\t\"")); assertEquals("\u0000\u001f ", QuotedStringTokenizer.unquote("\"\u0000\u001f\u0020\"")); assertEquals("\u0000\u001f ", QuotedStringTokenizer.unquote("\"\u0000\u001f\u0020\"")); assertEquals("ab\u001ec", QuotedStringTokenizer.unquote("ab\u001ec")); assertEquals("ab\u001ec", QuotedStringTokenizer.unquote("\"ab\u001ec\"")); }