private Tuple2<Integer, String> getInsertionPointAndQuery(int searchPoint) { String input = myCodeArea.getText(); int insertionPoint = getInsertionPoint(searchPoint, input); if (searchPoint > input.length()) { searchPoint = input.length(); } if (insertionPoint > searchPoint) { throw new StringIndexOutOfBoundsException("Cannot extract query from subtext \"" + input.substring(0, insertionPoint) + "\""); } input = input.substring(insertionPoint, searchPoint).trim(); return StringUtils.isAlpha(input) ? Tuples.t(insertionPoint, input.trim()) : null; }
@Test public void testIsAlpha() { assertFalse(StringUtils.isAlpha(null)); assertFalse(StringUtils.isAlpha("")); assertFalse(StringUtils.isAlpha(" ")); assertTrue(StringUtils.isAlpha("a")); assertTrue(StringUtils.isAlpha("A")); assertTrue(StringUtils.isAlpha("kgKgKgKgkgkGkjkjlJlOKLgHdGdHgl")); assertFalse(StringUtils.isAlpha("ham kso")); assertFalse(StringUtils.isAlpha("1")); assertFalse(StringUtils.isAlpha("hkHKHik6iUGHKJgU7tUJgKJGI87GIkug")); assertFalse(StringUtils.isAlpha("_")); assertFalse(StringUtils.isAlpha("hkHKHik*khbkuh")); }
@Override protected boolean handle(CharSequence str) { return StringUtils.isAlpha(str); }
/** * 检查字符串中的内容是否只包含字母,字符串为null将返回false,""将返回true,引用org.apache.commons.lang.StringUtils.isAlpha(String str)方法。<br> * 例: <br> * StringUtil.isAlpha(null) = false <br> * StringUtil.isAlpha("") = true <br> * StringUtil.isAlpha(" ") = false <br> * StringUtil.isAlpha("abc") = true <br> * @param str 要检查的字符串 - 可能为null * @return boolean 如果字符串不为null且只包含字母返回true,否则返回false。 */ public static boolean isAlpha(String str){ return StringUtils.isAlpha(str); }
public static boolean isalpha(CharSequence cs) { return StringUtils.isAlpha(cs); }
/** * 判断str是否全部为小写英文字母 * <p>Checks if the String contains only unicode letters.</p> * * <p><code>null</code> will return <code>false</code>. * An empty String (length()=0) will return <code>true</code>.</p> * * <pre> * StringUtils.isAlpha(null) = false * StringUtils.isAlpha("") = true * StringUtils.isAlpha(" ") = false * StringUtils.isAlpha("abc") = true * StringUtils.isAlpha("ab2c") = false * StringUtils.isAlpha("ab-c") = false * </pre> * * @param str the String to check, may be null * @return <code>true</code> if only contains letters, and is non-null * * @author daiqi * @date 2017年12月5日 下午8:08:37 */ public static boolean isAlpha(String str){ return StringUtils.isAlpha(str); }
public static boolean isAlpha(String text) { boolean result = false; try { result = StringUtils.isAlpha(text); } catch (Exception e) { logger.error("Is Alpha Error", e); } return result; }
public static boolean isAlpha(Object obj) { if (obj == null){ return false; } if (!(obj instanceof String)){ return false; } String s = obj.toString(); if ("".equals(s)) { return false; } return StringUtils.isAlpha(s); }
if(!StringUtils.isAlpha(country)) return false;
static boolean mightBeOrderBy(String name, String value) { return (name.toLowerCase().contains("order") || name.toLowerCase().contains("sort")) || value.toLowerCase().equals("asc") || value.toLowerCase().equals("desc") || (StringUtils.isNumeric(value) && Double.parseDouble(value) <= 1000) || (value.length() < 20 && StringUtils.isAlpha(value)); }
static boolean mightBeOrderBy(String name, String value) { return (name.toLowerCase().contains("order") || name.toLowerCase().contains("sort")) || value.toLowerCase().equals("asc") || value.toLowerCase().equals("desc") || (StringUtils.isNumeric(value) && Double.parseDouble(value) <= 1000) || (value.length() < 20 && StringUtils.isAlpha(value)); }
/** * Extract unit and actual value from resource value. * @param resourceValue Value of the resource * @return Array containing unit and value. [0]=unit, [1]=value * @throws IllegalArgumentException if units contain non alpha characters */ public static String[] parseResourceValue(String resourceValue) { String[] resource = new String[2]; int i = 0; for (; i < resourceValue.length(); i++) { if (Character.isAlphabetic(resourceValue.charAt(i))) { break; } } String units = resourceValue.substring(i); if (StringUtils.isAlpha(units) || units.equals("")) { resource[0] = units; resource[1] = resourceValue.substring(0, i); return resource; } else { throw new IllegalArgumentException("Units '" + units + "'" + " contains non alphabet characters, which is not allowed."); } }
default Selection isAlpha() { Selection results = new BitmapBackedSelection(); int i = 0; for (String next : this) { if (StringUtils.isAlpha(next)) { results.add(i); } i++; } return results; }
public static boolean isAlpha(ActionContext actionContext){ Thing self = actionContext.getObject("self"); CharSequence cs = (CharSequence) self.doAction("getCs", actionContext); return StringUtils.isAlpha(cs); }