List of utility methods to do String Unquote
String | unquote(String s) unquote if (s == null) { return null; if (s.startsWith("'") && s.endsWith("'") || s.startsWith("\"") && s.endsWith("\"") || s.startsWith("`") && s.endsWith("`")) { s = s.substring(1, s.length() - 1); return s; ... |
String | unquote(String s) unquote return unquote(s, "\""); |
String | unquote(String s) unquote while (s.startsWith("\"")) { s = s.substring(1); while (s.endsWith("\"")) { s = s.substring(0, s.length() - 1); return s; |
String | unquote(String s) unquote return s.startsWith("\"") ? s.substring(1, s.length() - 1) : s; |
String | unquote(String s) Removes enclosinf apostrophes from the given string if (s.contains("'")) { return s.substring(s.indexOf("'") + 1, s.lastIndexOf("'")); } else { return s; |
String | unquote(String s) Removes one pair of leading/trailing quotes ("x" or 'x' or `x` becomes x). if (s == null) { return null; char startChar = s.charAt(0); char endChar = s.charAt(s.length() - 1); if ((startChar == '\'' || startChar == '"' || startChar == '`') && startChar == endChar) return s.substring(1, s.length() - 1); else ... |
String | unquote(String s) remove double quotes around a string if (s != null && s.length() > 1) { if (s.charAt(0) == '\"' && s.charAt(s.length() - 1) == '\"') { s = s.substring(1, s.length() - 1); return s; |
String | unquote(String s, char c) Useful for unquoting strings, since StringTokenizer won't do it for us. int firstq = s.indexOf(c); int lastq = s.lastIndexOf(c); if (isQuoted(s, c)) return s.substring(firstq + 1, lastq); return null; |
String | unquote(String str) unquote if (str == null) return null; return str.replaceFirst("^\\\"(.*)\\\"$", "$1"); |
String | unquote(String str) Removes single or double quotes from a String if (isBlank(str)) return str; if ((str.startsWith("'") && str.endsWith("'")) || (str.startsWith("\"") && str.endsWith("\""))) { return str.substring(1, str.length() - 1); return str; |