List of usage examples for org.apache.commons.lang.text StrMatcher charMatcher
public static StrMatcher charMatcher(char ch)
From source file:it.jnrpe.utils.StringUtils.java
/** * Splits the given string using as separator the <code>separator</code> * character./*from w w w.jav a2 s . c o m*/ * * @param string * The string to be splitted * @param separator * The separator character * @param ignoreQuotes * <code>true</code> if the quotes must be ignored. * @return The splitted string */ public static String[] split(final String string, final char separator, final boolean ignoreQuotes) { StrTokenizer strtok = new StrTokenizer(string, StrMatcher.charMatcher(separator), StrMatcher.quoteMatcher()); return strtok.getTokenArray(); }
From source file:it.jnrpe.server.console.CommandExecutor.java
public boolean executeCommand(String commandLine) throws Exception { StrTokenizer strtok = new StrTokenizer(commandLine, StrMatcher.charMatcher(' '), StrMatcher.quoteMatcher()); String[] tokensAry = strtok.getTokenArray(); String commandName = tokensAry[0]; String[] params;/*from w w w. j a v a 2 s . co m*/ if (tokensAry.length == 1) { params = new String[0]; } else { params = new String[tokensAry.length - 1]; System.arraycopy(tokensAry, 1, params, 0, params.length); } IConsoleCommand command = getCommand(commandName); if (command != null) { return command.execute(params); } else { throw new UnknownCommandException("Unknown command :'" + commandName + "'"); } }
From source file:org.soaplab.clients.InputUtils.java
static String[] splitMultiValue(String value) { StrTokenizer tokenizer = new StrTokenizer(value, StrMatcher.charMatcher('|'), StrMatcher.quoteMatcher()); return tokenizer.getTokenArray(); }