List<String> (String parameterString) { parameterString = parameterString.trim(); List<String> params = new ArrayList<>(); StringBuilder token = new StringBuilder(128); boolean inQuotes = false; boolean escapedQuote = false; boolean nonEmpty = false; for (int i = 0; i < parameterString.length(); i++) { final char ch = parameterString.charAt(i); if (ch == '\"') { if (!escapedQuote) { inQuotes = !inQuotes; nonEmpty = true; continue; } escapedQuote = false; } else if (Character.isWhitespace(ch)) { if (!inQuotes) { if (token.length() > 0 || nonEmpty) { params.add(token.toString()); token.setLength(0); nonEmpty = false; } continue; } } else if (ch == '\\') { if (i < parameterString.length() - 1 && parameterString.charAt(i + 1) == '"') { escapedQuote = true; continue; } } token.append(ch); } if (token.length() > 0 || nonEmpty) { params.add(token.toString()); } return params; }