本文整理汇总了Java中org.apache.commons.lang3.StringUtils.isAlphanumeric方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.isAlphanumeric方法的具体用法?Java StringUtils.isAlphanumeric怎么用?Java StringUtils.isAlphanumeric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.isAlphanumeric方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkAlphaNumeric
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static boolean checkAlphaNumeric(JTextField tf, String input) {
String text = tf.getText().trim();
if (text.length() == 0)
return true;
if (!StringUtils.isAlphanumeric(text)) {
JOptionPane.showMessageDialog(null, input + "ֻ����Ӣ�ĺ�������ɣ�����ֻ����ӦΪ��ͷ");
tf.grabFocus();
return false;
}
if (text.length() != 0 && !StringUtils.isAlpha(String.valueOf(text.charAt(0)))) {
JOptionPane.showMessageDialog(null, input + "ֻ����Ӣ�ĺ�������ɣ�����ֻ��Ӣ�Ŀ�ͷ");
tf.grabFocus();
return false;
}
return true;
}
示例2: isAlphaNumeric
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private boolean isAlphaNumeric ( StringBuffer resultsBuf, ObjectNode serviceMetersDefinition, String name ) {
if ( !StringUtils.isAlphanumeric( name ) ) {
ObjectNode metricSettings = (ObjectNode) serviceMetersDefinition.get( name );
metricSettings.put( "errors", true );
updateServiceParseResults( resultsBuf, CSAP.CONFIG_PARSE_WARN,
getErrorHeader()
+ "Invalid attribute name: " + name
+ ", must be alphaNumeric only. Removing" );
return false;
}
return true;
}
示例3: verifyNewServiceName
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private void verifyNewServiceName ( ReleasePackage currentPackageModel, String newName )
throws IOException {
ArrayList<String> currentServices = corePortals.getServices( currentPackageModel );
if ( !StringUtils.isAlphanumeric( newName ) ) {
throw new IOException( "Service names must be alpha numeric only, with no spaces or other special characters: " + newName );
}
if ( currentServices.contains( newName ) ) {
throw new IOException( "Found existing service, try another name: " + newName );
}
}
示例4: isSupported
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public boolean isSupported(final Path workdir, final String name) {
if(workdir.isRoot()) {
if(StringUtils.isNotBlank(name)) {
return StringUtils.isAlphanumeric(name);
}
}
return true;
}
示例5: escape
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
protected String escape(final String path) {
final StringBuilder escaped = new StringBuilder();
for(char c : path.toCharArray()) {
if(StringUtils.isAlphanumeric(String.valueOf(c))) {
escaped.append(c);
}
else {
escaped.append("\\").append(c);
}
}
return escaped.toString();
}
示例6: escape
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* Escape blank
*
* @param path Filename
* @return Escaped whitespace in path
*/
protected String escape(final String path) {
final StringBuilder escaped = new StringBuilder();
for(char c : path.toCharArray()) {
if(StringUtils.isAlphanumeric(String.valueOf(c))
|| c == Path.DELIMITER) {
escaped.append(c);
}
else {
escaped.append("\\").append(c);
}
}
return escaped.toString();
}