/** * Removes all leading and ending quotes (single and double) from the string * * @param s the string * @return the string without leading and ending quotes (single and double) */ public static String removeLeadingAndEndingQuotes(String s) { if (isEmpty(s)) { return s; } String copy = s.trim(); if (copy.startsWith("'") && copy.endsWith("'")) { return copy.substring(1, copy.length() - 1); } if (copy.startsWith("\"") && copy.endsWith("\"")) { return copy.substring(1, copy.length() - 1); } // no quotes, so return as-is return s; }