List of usage examples for org.apache.commons.lang StringUtils containsNone
public static boolean containsNone(String str, String invalidChars)
Checks that the String does not contain certain characters.
From source file:StringUtilsExampleV1.java
public static void main(String args[]) { System.err.println(StringUtils.containsNone("r u m t", new char[] { 'r', 'o' })); }
From source file:MainClass.java
public static void main(String[] args) { //Check that a string does not contain any of these characters !@#$%^&* System.out.println(/* www . j a v a2s . c om*/ "14) Check that ABCD contains none of !@#$%^&* >>>" + StringUtils.containsNone("ABCD", "!@#$%^&*")); }
From source file:StringUtilsTrial.java
public static void main(String[] args) { // Check that a string does not contain any of these characters !@#$%^&* System.out.println(/*from w w w.j a va2 s . c o m*/ "14) Check that ABCD contains none of !@#$%^&* >>>" + StringUtils.containsNone("ABCD", "!@#$%^&*")); }
From source file:com.rslakra.java.string.TestApacheStringUtils.java
public static void main(String args[]) { System.err.println(StringUtils.abbreviate("Take time off working", 0, 10)); System.err.println(StringUtils.capitalize("vanderLust")); System.err.println(StringUtils.center("MTV", 7, '=')); System.err.println(StringUtils.chomp("temperature", "ure")); System.err.println(StringUtils.chop("Dane")); System.err.println(StringUtils.contains("Dorothy", "oro")); System.err.println(StringUtils.containsNone("r u m t", new char[] { 'r', 'o' })); System.err.println(StringUtils.containsOnly("r u m t", new char[] { 'r', 'o' })); System.err.println(StringUtils.countMatches("arthur", "r")); System.err.println(StringUtils.deleteWhitespace("f f f f")); System.err.println(StringUtils.difference("govern", "government")); System.err.println(StringUtils.getLevenshteinDistance("govern", "government")); }
From source file:com.dcsquare.hivemq.spi.topic.PermissionTopicMatcher.java
public boolean matches(final String topicSubscription, final String actualTopic) throws InvalidTopicException { final String subscription = StringUtils.stripEnd(topicSubscription, "/"); String topic = actualTopic;//from w w w . ja va2s . c o m if (actualTopic.length() > 1) { topic = StringUtils.stripEnd(actualTopic, "/"); } if (StringUtils.containsNone(topicSubscription, "#+")) { return subscription.equals(topic); } return matchesWildcards(subscription, topic); }
From source file:com.dtolabs.rundeck.core.utils.OptsUtil.java
public static void escapeChars(StringBuilder out, String str) { if (StringUtils.containsNone(str, CSV_SEARCH_CHARS) && !"".equals(str)) { if (str != null) { out.append(str);/*from w w w .j a v a 2 s . c om*/ } return; } out.append(DBL_QUOTE); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == DBL_QUOTE) { out.append(DBL_QUOTE); // escape double quote } out.append(c); } out.append(DBL_QUOTE); }
From source file:gov.va.med.pharmacy.peps.presentation.common.displaytag.CsvView.java
/** * Escaping for csv format./*from w ww .ja v a 2s .c o m*/ * <ul> * <li>Quotes inside quoted strings are escaped with a /</li> * <li>Fields containings newlines or , are surrounded by "</li> * </ul> * Note this is the standard CVS format and it's not handled well by excel. * @param value the value * @return The appropriate escape value * @see org.displaytag.export.BaseExportView#escapeColumnValue(java.lang.Object) */ protected String escapeColumnValue(Object value) { String stringValue = StringUtils.trim(value.toString()); String cleanStringValue = ""; // String cleanStringValue = stringValue.replaceAll("\\<.*?>", ""); try { cleanStringValue = extractText(stringValue); } catch (IOException e) { LOG.debug(e.getMessage()); } if (!StringUtils.containsNone(cleanStringValue, new char[] { '\n', ',' })) { return "\"" + //$NON-NLS-1$ StringUtils.replace(cleanStringValue, "\"", "\\\"") + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return cleanStringValue; }
From source file:com.redhat.rhn.taskomatic.task.repomd.RepomdWriter.java
/** * Removes all control characters from passed in String. * @param pkgId package id/*from w w w . ja v a 2 s. c om*/ * @param input char input */ protected static String sanitize(Long pkgId, String input) { if (StringUtils.containsNone(input, CONTROL_CHARS)) { return input; } if (log.isDebugEnabled()) { log.debug("Package " + pkgId + " metadata contains control chars, cleanup required: " + input); } return StringUtils.replaceChars(input, CONTROL_CHARS, CONTROL_CHARS_REPLACEMENT); }
From source file:com.intuit.tank.common.ScriptUtil.java
private static void getVar(Set<String> ret, String s) { Set<String> toTest = new HashSet<String>(); StringBuilder sb = new StringBuilder(); for (char c : s.toCharArray()) { if (c == ',' || c == ')') { toTest.add(sb.toString());//www . j a v a 2s . c o m sb = new StringBuilder(); } else if (c == '(') { sb = new StringBuilder(); } else { sb.append(c); } } toTest.add(sb.toString()); for (String group : toTest) { group = group.trim(); if (StringUtils.isNotBlank(group) && StringUtils.containsNone(group, " ()'\",")) { if (!NumberUtils.isNumber(group)) { // its a variable ret.add(group); } } } }
From source file:com.dtolabs.rundeck.core.cli.CLIUtils.java
private static void quoteUnixShellArg(StringBuilder sb, String arg) { if (StringUtils.containsNone(arg, UNIX_SHELL_CHARS) && StringUtils.containsNone(arg, WS_CHARS) && StringUtils.containsNone(arg, " ")) { if (arg != null) { sb.append(arg);/*w ww. ja v a 2 s . c om*/ } return; } sb.append("'"); sb.append(arg.replace("'", "'\"'\"'")); sb.append("'"); }