美文网首页
Android 判断数数字 判断是字母

Android 判断数数字 判断是字母

作者: MakerSir | 来源:发表于2020-11-03 15:45 被阅读0次

判断是数字

public static boolean isNumeric(String str){

for (int i = str.length();--i>=0;){

if (Character.isDigit(str.charAt(i))){

return true;

}

}

return false;

}

判断是字母

public static boolean isChar(String fstrData){

for (int i = fstrData.length();--i>=0;) {

char c = fstrData.charAt(i);

if (((c >='a' &&c <='z') || (c >='A' &&c <='Z'))) {

return true;

}

}

return false;

}

相关文章

网友评论

      本文标题:Android 判断数数字 判断是字母

      本文链接:https://www.haomeiwen.com/subject/splcvktx.html