if (!isAlphanumeric(this.prefix)) { throw new IllegalArgumentException("Prefix setting must be alphanumeric only [A-Za-z0-9]");
public static String getSolidFireVolumeName(String strCloudStackVolumeName) { final String specialChar = "-"; StringBuilder strSolidFireVolumeName = new StringBuilder(); for (int i = 0; i < strCloudStackVolumeName.length(); i++) { String strChar = strCloudStackVolumeName.substring(i, i + 1); if (StringUtils.isAlphanumeric(strChar)) { strSolidFireVolumeName.append(strChar); } else { strSolidFireVolumeName.append(specialChar); } } return strSolidFireVolumeName.toString(); }
private String getDotSafeName(String inName) { String name = null; if(StringUtils.isAlphanumeric(inName)) { name = inName; } else { name = "\""+inName+"\""; } return name; }
@Override public boolean isValid(String value, ConstraintValidatorContext context) { if (value == null) { return false; } return StringUtils.isAlphanumeric(value); } }
private String getDotSafeName(String inName) { String name = null; if(StringUtils.isAlphanumeric(inName)) { name = inName; } else { name = "\""+inName+"\""; } return name; }
public void ensureValidCode(String code) { if (!StringUtils.isAlphanumeric(code)) { throw new IllegalArgumentException( "Code is not alphanumeric: " + code); } }
public void ensureValidCode(String code) { if (!StringUtils.isAlphanumeric(code)) { throw new IllegalArgumentException( "Code is not alphanumeric: " + code); } }
public static boolean isAlphaNumeric(String text) { return StringUtils.isAlphanumeric(text.replaceAll("-", "a").replaceAll("\\.", "a")); }
static String checkOtherLetters(String letter) { letter = StringUtils.replaceChars(letter, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"); if (letter.equals("_") || letter.equals("$") || StringUtils.isAlphanumeric(letter)){ return letter; } else { return "_"; } } }
protected List<String> removeDollarWordAndNonAlphaFromList(List<String> list) { List<String> result = new ArrayList<String>(); Pattern p = Pattern.compile("^\\$(\\d{1,3}(\\,\\d{3})*|(\\d+))(\\.\\d{2})?$"); for (String w : list) { if (!(p.matcher(w).find()) && StringUtils.isAlphanumeric(w) && (w.length() >= 3 || !StringUtils.isAlpha(w))) result.add(w); } return result; }
public List<String> removeVenuePart(ArrayList<String> toks) { List<String> results = new ArrayList<String>(); boolean bVenuePart = false; for (String word : toks) { // beginning of venue part if (word.equals("at") || word.equals("@")) bVenuePart = true; // end of venue part if (!StringUtils.isAlphanumeric(word) || word.startsWith("<punc")) bVenuePart = false; if (!bVenuePart && !word.startsWith("<punc")) results.add(word); } return results; }
protected boolean isCapitalized(String lookup) { String[] titleWords = lookup.split(" "); int count = 0; for (String word : titleWords) { if (word.length() < 2) // '-', '|', ':' break; if (word.equals(word.toLowerCase()) && (!Arrays.asList(englishPrepositions).contains(word)) && word.length() > 3 && StringUtils.isAlphanumeric(word)) continue; // was return false; if (count > 3) break; count++; } return true; }
static String checkOtherLetters(String letter) { letter = StringUtils.replaceChars(letter, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"); if (letter.equals("_") || letter.equals("$") || StringUtils.isAlphanumeric(letter)){ return letter; } else { return "_"; } } }
public static String escapeFeatureName(String name) { // TODO Issue 120: improve the escaping // the fix was necessary due to Issue 32 // http://code.google.com/p/dkpro-tc/issues/detail?id=32 StringBuilder sb = new StringBuilder(); for (int i = 0; i < name.length(); i++) { String c = name.substring(i, i + 1); if (StringUtils.isAlphanumeric(c) || c.equals("_")) { sb.append(c); } else { sb.append("u"); sb.append(c.codePointAt(0)); } } return sb.toString(); }
public static String escapeFeatureName(String name) { // TODO Issue 120: improve the escaping // the fix was necessary due to Issue 32 // http://code.google.com/p/dkpro-tc/issues/detail?id=32 StringBuilder sb = new StringBuilder(); for (int i = 0; i < name.length(); i++) { String c = name.substring(i, i + 1); if (StringUtils.isAlphanumeric(c) || c.equals("_")) { sb.append(c); } else { sb.append("u"); sb.append(c.codePointAt(0)); } } return sb.toString(); }
private Directory getStoreDirectory(String store) throws StorageException { Preconditions.checkArgument(StringUtils.isAlphanumeric(store), "Invalid store name: %s", store); String dir = basePath + File.separator + store; try { File path = new File(dir); if (!path.exists()) path.mkdirs(); if (!path.exists() || !path.isDirectory() || !path.canWrite()) throw new PermanentStorageException("Cannot access or write to directory: " + dir); log.debug("Opening store directory [{}]", path); return FSDirectory.open(path); } catch (IOException e) { throw new PermanentStorageException("Could not open directory: " + dir, e); } }
/** * @return Less than 0 if toCheck is less than atLeast, 0 if they are equal and more than 0 if toCheck is greater * than atLeast, is only or starts with alpha chars */ private int compareToCheckToNumericAtLeast(String toCheck, String atLeast) { if (StringUtils.isNumeric(toCheck)) { return compareNumerals(toCheck, atLeast); } else if (StringUtils.isAlphanumeric(toCheck)) { return compareAlphaNumericToCheckToNumericAtLeast(toCheck, atLeast); } return 1; }
private void qcMD5s(String name, List<String> md5s) { final String exampleMD5 = "709a1f482cce68992c637da3cff824a8"; for (String md5 : md5s) { if ( md5 == null ) throw new IllegalArgumentException("Null MD5 found in test " + name); if ( md5.equals("") ) // ok continue; if ( ! StringUtils.isAlphanumeric(md5) ) throw new IllegalArgumentException("MD5 contains non-alphanumeric characters test " + name + " md5=" + md5); if ( md5.length() != exampleMD5.length() ) throw new IllegalArgumentException("Non-empty MD5 of unexpected number of characters test " + name + " md5=" + md5); } }
protected int[] getXY(String xy) { xy = xy.trim(); if (StringUtils.isEmpty(xy)) { return new int[] { -1, -1 }; } if (!StringUtils.isAlphanumeric(xy)) { return null; } CellReference ref = new CellReference(xy); return new int[] { ref.getRow() < 0 ? -1 : ref.getRow(), ref.getCol() < 0 ? -1 : ref.getCol() }; } }
public final static int[] getXY(String xy) { xy = xy.trim(); if (StringUtils.isEmpty(xy)) { return new int[] { -1, -1 }; } if (!StringUtils.isAlphanumeric(xy)) { return null; } CellReference ref = new CellReference(xy); return new int[] { ref.getRow() < 0 ? -1 : ref.getRow(), ref.getCol() < 0 ? -1 : ref.getCol() }; } }