@Test public void testIsAlphaspace() { assertFalse(StringUtils.isAlphaSpace(null)); assertTrue(StringUtils.isAlphaSpace("")); assertTrue(StringUtils.isAlphaSpace(" ")); assertTrue(StringUtils.isAlphaSpace("a")); assertTrue(StringUtils.isAlphaSpace("A")); assertTrue(StringUtils.isAlphaSpace("kgKgKgKgkgkGkjkjlJlOKLgHdGdHgl")); assertTrue(StringUtils.isAlphaSpace("ham kso")); assertFalse(StringUtils.isAlphaSpace("1")); assertFalse(StringUtils.isAlphaSpace("hkHKHik6iUGHKJgU7tUJgKJGI87GIkug")); assertFalse(StringUtils.isAlphaSpace("_")); assertFalse(StringUtils.isAlphaSpace("hkHKHik*khbkuh")); }
@Override protected boolean handle(CharSequence str) { return StringUtils.isAlphaSpace(str); }
@Override protected boolean handle(CharSequence str) { return StringUtils.isAlphaSpace(str); }
/** * 检查字符串中的内容是否只包含字母和空格,字符串为null将返回false,""将返回true,引用org.apache.commons.lang.StringUtils.isAlphaSpace(String str)方法。<br> * 例: <br> * StringUtil.isAlphaSpace(null) = false <br> * StringUtil.isAlphaSpace("") = true <br> * StringUtil.isAlphaSpace(" ") = true <br> * StringUtil.isAlphaSpace("abc") = true <br> * StringUtil.isAlphaSpace("ab c") = true <br> * StringUtil.isAlphaSpace("ab-c") = false <br> * @param str 要检查的字符串 - 可能为null * @return boolean 如果字符串不为null且只包含字母和空格返回true,否则返回false。 */ public static boolean isAlphaSpace(String str){ return StringUtils.isAlphaSpace(str); }
public static boolean isalphaspace(CharSequence cs) { return StringUtils.isAlphaSpace(cs); }
public static boolean isAlphaSpace(ActionContext actionContext){ Thing self = actionContext.getObject("self"); CharSequence cs = (CharSequence) self.doAction("getCs", actionContext); return StringUtils.isAlphaSpace(cs); }
private String getReferenceFromContent(String content) { // JSword does not know the basis (default book) so prepend it if it looks like JSword failed to work it out // We only need to worry about the first ref because JSword uses the first ref as the basis for the subsequent refs // if content starts with a number and is not followed directly by an alpha char e.g. 1Sa String reference = null; if (content != null && content.length() > 0 && StringUtils.isNumeric(content.subSequence(0, 1)) && (content.length() < 2 || !StringUtils.isAlphaSpace(content.subSequence(1, 2)))) { // maybe should use VerseRangeFactory.fromstring(orig, basis) // this check for a colon to see if the first ref is verse:chap is not perfect but it will do until JSword adds a fix int firstColonPos = content.indexOf(":"); boolean isVerseAndChapter = firstColonPos > 0 && firstColonPos < 4; if (isVerseAndChapter) { reference = parameters.getBasisRef().getBook().getOSIS() + " " + content; } else { reference = parameters.getBasisRef().getBook().getOSIS() + " " + parameters.getBasisRef().getChapter() + ":" + content; } log.debug("Patched reference:" + reference); } else if (content != null){ // Avoid urls of type 'matt 3:14' by excluding urns with a space if (content.contains(" ")) { reference = content.replace(":", "/"); } else reference = content; } return reference; }