public static @NotNull String unquoteAndEscape(final @NotNull String text, final int start, final int end) {
    if (start == end) {
      return "";
    }

    int startIndex = start;
    int endIndex = end;

    final char firstChar = text.charAt(startIndex);
    final char lastChar = text.charAt(endIndex - 1);
    if (firstChar == '\'' || firstChar == '"') {
      startIndex++;
    } else {
      return text.substring(startIndex, endIndex); // plain text is unescapable
    }
    if (lastChar == '\'' || lastChar == '"') {
      endIndex--;
    }

    if (startIndex > endIndex) {
      // We were given only a single quote that doesn't terminate, we can't unescape it
      return text.substring(start, end);
    }

    return TokenParser.unescape(text, startIndex, endIndex, i -> i == firstChar || i == TokenParser.ESCAPE);
  }
Removes leading/trailing quotes from the given string, if necessary, and removes escaping {@code '\'} characters.

@param text the input text
@param start the starting index of the substring
@param end the ending index of the substring
@return the output substring
@since 4.10.0
text-minimessage/src/main/java/net/kyori/adventure/text/minimessage/internal/parser/node/TagPart.java