本文整理匯總了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();
}