docs: private static String unquote(String text, char quoteChar) {
      if (!isQuoted(text, quoteChar)) return text;
  
      if (text.length() == 2) return "";
  
      String search = emptyQuoted(quoteChar);
      int nbMatch = 0;
      int start = -1;
      do {
        start = text.indexOf(search, start + 2);
        // ignore the second to last character occurrence, as the last character is a quote.
        if (start != -1 && start != text.length() - 2) ++nbMatch;
      } while (start != -1);
  
      // no escaped quotes found, simply remove surrounding quotes and return.
      if (nbMatch == 0) return text.substring(1, text.length() - 1);
  
      // length of the new string will be its current length - the number of occurrences.
      int newLength = text.length() - nbMatch - 2;
      char[] result = new char[newLength];
      int newIdx = 0;
      // track whenever a quoteChar is encountered and the previous character is not a quoteChar.
      boolean firstFound = false;
      for (int i = 1; i < text.length() - 1; i++) {
        char c = text.charAt(i);
        if (c == quoteChar) {
          if (firstFound) {
            // The previous character was a quoteChar, don't add this to result, this action in
            // effect removes consecutive quotes.
            firstFound = false;
          } else {
            // found a quoteChar and the previous character was not a quoteChar, include in result.
            firstFound = true;
            result[newIdx++] = c;
          }
        } else {
          // non quoteChar encountered, include in result.
          result[newIdx++] = c;
          firstFound = false;
        }
      }
      return new String(result);
    }