@NotNull
  @Contract(pure = true)
  public static List<String> splitHonorQuotes(@NotNull String s, char separator) {
    List<String> result = new ArrayList<>();
    StringBuilder builder = new StringBuilder(s.length());
    char quote = 0;
    boolean isEscaped = false;
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      boolean isSeparator = c == separator;
      boolean isQuote = c == '"' || c == '\'';
      boolean isQuoted = quote != 0;
      boolean isEscape = c == '\\';

      if (!isQuoted && isSeparator) {
        if (builder.length() > 0) {
          result.add(builder.toString());
          builder.setLength(0);
        }
        continue;
      }

      if (!isEscaped && isQuote && (quote == 0 || quote == c)) {
        quote = isQuoted ? 0 : c;
      }

      isEscaped = isEscape && !isEscaped;

      builder.append(c);
    }
    if (builder.length() > 0) {
      result.add(builder.toString());
    }
    return result;
  }
@NotNull
  @Contract(pure = true)
  public static List<String> splitHonorQuotes(@NotNull String s, char separator)