/** * Undoubles the quotes inside the string <br> Example:<br> * <pre> * hello""world becomes hello"world * </pre> * * @param str input string to dequote * @param quote the quoting char * * @return dequoted string */ public static String dequote(String str, char quote) { // Is there anything to dequote? if (str == null) { return null; } return dequote(str, 0, str.length(), quote); }
quoted ? dequote(str, oldPos + 1, pos - 1, quote) : substring(str, oldPos, pos);
quoted ? dequote(str, oldPos + 1, pos - 1, quote) : substring(str, oldPos, pos);
/** * Undoubles the quotes inside the string <br> Example:<br> * <pre> * hello""world becomes hello"world * </pre> * * @param str input string to dequote * @param quote the quoting char * * @return dequoted string */ public static String dequote(String str, char quote) { // Is there anything to dequote? if (str == null) { return null; } return dequote(str, 0, str.length(), quote); }
quoted ? dequote(str, oldPos + 1, pos - 1, quote) : substring(str, oldPos, pos);
/** * Undoubles the quotes inside the string <br> Example:<br> * <pre> * hello""world becomes hello"world * </pre> * * @param str input string to dequote * @param quote the quoting char * * @return dequoted string */ public static String dequote(String str, char quote) { // Is there anything to dequote? if (str == null) { return null; } return dequote(str, 0, str.length(), quote); }
public static String dequoteFull(String str, int begin, int end, char quote) { // If empty substring, return empty string if (begin == end) { return ""; } // If not quoted, return string if (str.charAt(begin) != quote) { return str.substring(begin, end); } int _end = end - 1; if ((str.length() < 2) || (str.charAt(_end) != quote)) { throw new IllegalArgumentException( "Closing quote missing in string '" + substring(str, begin, end) + "'"); } return dequote(str, begin + 1, _end, quote); }
public static String dequoteFull(String str, int begin, int end, char quote) { // If empty substring, return empty string if (begin == end) { return ""; } // If not quoted, return string if (str.charAt(begin) != quote) { return str.substring(begin, end); } int _end = end - 1; if ((str.length() < 2) || (str.charAt(_end) != quote)) { throw new IllegalArgumentException( "Closing quote missing in string '" + substring(str, begin, end) + "'"); } return dequote(str, begin + 1, _end, quote); }
public static String dequoteFull(String str, int begin, int end, char quote) { // If empty substring, return empty string if (begin == end) { return ""; } // If not quoted, return string if (str.charAt(begin) != quote) { return str.substring(begin, end); } int _end = end - 1; if ((str.length() < 2) || (str.charAt(_end) != quote)) { throw new IllegalArgumentException( "Closing quote missing in string '" + substring(str, begin, end) + "'"); } return dequote(str, begin + 1, _end, quote); }
quoted ? dequote(str, oldPos + 1, pos - 1, quote) : substring(str, oldPos, pos));
quoted ? dequote(str, oldPos + 1, pos - 1, quote) : substring(str, oldPos, pos));
quoted ? dequote(str, oldPos + 1, pos - 1, quote) : substring(str, oldPos, pos));