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:com.googlecode.jtiger.modules.ecside.core.bean.ColumnDefaults.java
/** * If the format contains any of these formats then it is custom format * doing inline./*w w w. j av a2 s . c om*/ */ static boolean isNamedFormat(String format) { char args[] = { '#', '/', '-' }; if (StringUtils.containsNone(format, args)) { return true; } return false; }
From source file:com.dtolabs.rundeck.core.cli.CLIUtils.java
public static void escapeUnixShellChars(StringBuilder out, String str) { if (StringUtils.containsNone(str, UNIX_SHELL_CHARS)) { if (str != null) { out.append(str);/*from w w w . j ava 2 s. c o m*/ } return; } for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (UNIX_SHELL_CHARS.indexOf(c) >= 0) { out.append('\\'); } else if (WS_CHARS.indexOf(c) >= 0) { out.append('\\'); if (c == CharUtils.CR) { out.append('r'); } else if (c == CharUtils.LF) { out.append('n'); } else if (c == '\t') { out.append('t'); } continue; } out.append(c); } }
From source file:net.sourceforge.fenixedu.util.StringFormatter.java
/** * Checks that a string does not contain special characters (only * alphanumeric ones)./*from w w w . ja v a 2s . c o m*/ * * @param string * the string to check * @return <code>true</code> if the strings contains a special character */ protected static boolean containsNoneSpecialChars(String string) { return StringUtils.containsNone(string, specialChars); }
From source file:com.iyonger.apm.web.model.AgentManager.java
/** * Filter the shared agents from given agents. * * @param agents all agents/* w w w.j av a 2 s . c om*/ * @return userOwned agents. */ public Set<AgentIdentity> filterSharedAgents(Set<AgentIdentity> agents) { Set<AgentIdentity> userAgent = new HashSet<AgentIdentity>(); for (AgentIdentity each : agents) { String region = ((AgentControllerIdentityImplementation) each).getRegion(); if (StringUtils.containsNone(region, "owned_")) { userAgent.add(each); } } return userAgent; }
From source file:com.doculibre.constellio.entities.IndexField.java
public static boolean isValidName(String name) { return StringUtils.containsNone(name, FORBIDDEN_CHARS); }
From source file:net.ymate.platform.webmvc.util.StringEscapeUtils.java
public static String escapeCsv(String str) { if (StringUtils.containsNone(str, CSV_SEARCH_CHARS)) { if (str != null) { return str; }// www. j a va 2 s.c o m return null; } StringBuilder _out = new StringBuilder(); _out.append(CSV_QUOTE); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == CSV_QUOTE) { _out.append(CSV_QUOTE); } _out.append(c); } return _out.append(CSV_QUOTE).toString(); }
From source file:org.artifactory.api.module.ModuleInfoUtils.java
/** * Verifies the given path is legit and removes the remaining brackets from it * * @param itemPathPattern the item path to verify * @return the repo path without any brackets tokens in it, null in case the repo path is invalid * an invalid repo path is one that has brackets between the groupId and the moduleId or a bracket before them *//* w w w. jav a 2 s . c om*/ private static String verifyAndBuildPathPattern(String itemPathPattern) { String[] tokens = StringUtils.split(itemPathPattern, "/"); StringBuilder newPathBuilder = new StringBuilder(); boolean foundBracketToken = false; for (String token : tokens) { if (StringUtils.containsNone(token, new char[] { '[', ']' })) { if (foundBracketToken) { // Invalid repo path, found a bracket between the groupId and the moduleId // or a bracket before them, returning null return null; } newPathBuilder.append(token).append("/"); foundBracketToken = false; } else { foundBracketToken = true; } } return newPathBuilder.toString(); }
From source file:org.displaytag.export.CsvView.java
/** * Escaping for csv format.// ww w . j av a 2 s .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. * * @see org.displaytag.export.BaseExportView#escapeColumnValue(java.lang.Object) */ protected String escapeColumnValue(Object value) { String retorno = super.escapeColumnValue(value); if (!"".equals(retorno)) { String stringValue = StringUtils.trim(retorno); if (!StringUtils.containsNone(stringValue, new char[] { '\n', ',' })) { return "\"" + //$NON-NLS-1$ StringUtils.replace(stringValue, "\"", "\\\"") + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return stringValue; } return null; }
From source file:org.glimpse.server.manager.orm.OrmUserManager.java
private boolean isValidUserId(String userId) { if (userId == null) { return false; }/*from w ww. java 2s .c o m*/ if (userId.length() < USER_ID_MIN_LENGTH || userId.length() > USER_ID_MAX_LENGTH) { return false; } return StringUtils.containsNone(userId, "'<>"); }
From source file:org.glimpse.server.manager.orm.OrmUserManager.java
private boolean isValidPassword(String password) { if (password == null) { return false; }/* ww w . j a v a 2s . c o m*/ if (password.length() < PASSWORD_MIN_LENGTH || password.length() > PASSWORD_MAX_LENGTH) { return false; } return StringUtils.containsNone(password, "'"); }