/** * Splits String value with comma "," used as a separator. The whitespaces around values are trimmed. * * @param input string to split * @return {@code null} if provided value was {@code null}, split parts otherwise (trimmed) */ public static String[] splitByComma(String input, boolean allowEmpty) { if (input == null) { return null; } String[] splitWithEmptyValues = trim(input).split("\\s*,\\s*", -1); return allowEmpty ? splitWithEmptyValues : subraction(splitWithEmptyValues, new String[]{""}); }
/** * Splits String value with comma "," used as a separator. The whitespaces around values are trimmed. * * @param input string to split * @return {@code null} if provided value was {@code null}, split parts otherwise (trimmed) */ public static String[] splitByComma(String input, boolean allowEmpty) { if (input == null) { return null; } String[] splitWithEmptyValues = trim(input).split("\\s*,\\s*", -1); return allowEmpty ? splitWithEmptyValues : subtraction(splitWithEmptyValues, new String[]{""}); }
@Override public void run() { String command = threadCommand; String[] threadArgs = trim(command.replaceAll("\\$t", "" + threadID)).split(" "); // TODO &t #4 m.putmany x k if ("m.putmany".equals(threadArgs[0]) || "m.removemany".equals(threadArgs[0])) { if (threadArgs.length < 4) { command += " " + Integer.parseInt(threadArgs[1]) * threadID; } } handleCommand(command); } });
@Override public void run() { String command = threadCommand; String[] threadArgs = trim(command.replaceAll("\\$t", "" + threadID)).split(" "); // TODO &t #4 m.putmany x k if ("m.putmany".equals(threadArgs[0]) || "m.removemany".equals(threadArgs[0])) { if (threadArgs.length < 4) { command += " " + Integer.parseInt(threadArgs[1]) * threadID; } } handleCommand(command); } });
private static void fillProperties(Node node, Properties properties) { if (properties == null) { return; } for (Node n : childElements(node)) { String name = cleanNodeName(n); if ("property".equals(name)) { String propertyName = getTextContent(n.getAttributes().getNamedItem("name")); String value = trim(getTextContent(n)); properties.setProperty(propertyName, value == null ? "" : value); } } }
private static void fillProperties(Node node, Properties properties) { if (properties == null) { return; } for (Node n : childElements(node)) { String name = cleanNodeName(n); if ("property".equals(name)) { String propertyName = getTextContent(n.getAttributes().getNamedItem("name")); String value = trim(getTextContent(n)); properties.setProperty(propertyName, value == null ? "" : value); } } }
return; command = trim(command); if (command.length() == 0) { return; String[] args = new String[argsSplit.length]; for (int i = 0; i < argsSplit.length; i++) { args[i] = trim(argsSplit[i]); println("echo: " + echo); } else if ("ns".equals(first)) { handleNamespace(trim(command.substring(first.length()))); } else if ("whoami".equals(first)) { handleWhoami();
return; command = trim(command); if (command.length() == 0) { return; String[] args = new String[argsSplit.length]; for (int i = 0; i < argsSplit.length; i++) { args[i] = trim(argsSplit[i]); println("echo: " + echo); } else if ("ns".equals(first)) { handleNamespace(trim(command.substring(first.length()))); } else if ("whoami".equals(first)) { handleWhoami();