code: static String unescapeCommandAttributeValue(String s, QuoteStyle quoteStyle) {
      // NOTE: we don't just use String.replace since it internally allocates/compiles a regular
      // expression.  Instead we have a handrolled loop.
      int index = s.indexOf(quoteStyle == QuoteStyle.DOUBLE ? "\\\"" : "\\\'");
      if (index == -1) {
        return s;
      }
      StringBuilder buf = new StringBuilder(s.length());
      buf.append(s);
      boolean nextIsQ = buf.charAt(s.length() - 1) == quoteStyle.getQuoteChar();
      for (int i = s.length() - 2; i >= index; i--) {
        char c = buf.charAt(i);
        if (c == '\\' && nextIsQ) {
          buf.deleteCharAt(i);
        }
        nextIsQ = c == quoteStyle.getQuoteChar();
      }
      return buf.toString();
    }
docs: Unescapes backslash quote sequences in an attribute value to just the quote.