Here you can find the source of unquote(String s)
public static String unquote(String s)
//package com.java2s; //License from project: Apache License public class Main { public static String unquote(String s) { if (s == null) { return ""; }/* w w w.j av a2 s. c o m*/ if (startsWith(s, "'")) { return unwrap(s, "'", "'"); } else if (startsWith(s, "\"")) { return unwrap(s, "\"", "\""); } return s.trim(); } public static boolean startsWith(String s, String prefix) { if (s == null) { return false; } for (int i = 0; i < s.length(); i++) { if (Character.isWhitespace(s.charAt(i))) { continue; } else { return s.regionMatches(i, prefix, 0, prefix.length()); } } return false; } public static String unwrap(String s, String prefix, String suffix) { int start = 0, end = s.length() - 1; while (start < s.length()) { if (!Character.isWhitespace(s.charAt(start))) { break; } ++start; } while (end >= 0) { if (!Character.isWhitespace(s.charAt(end))) { break; } --end; } return s.substring(start + prefix.length(), end - suffix.length() + 1); } }