JAVA判断字符串是否为数字
2010-03-05 10:26
369 查看
String转Character数组,用Character的isDigit和isLetter函数去判断。
public static boolean isNumeric(String str) {
for (int i = str.length(); i = 0;) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
public static boolean isNumeric(String str) {
Pattern pattern = Pattern.compile("[0-9]*");
return pattern.matcher(str).matches();
}
public static boolean isNumeric(String str) {
if (str.matches("““d*")) {
return true;
}
return false;
}
public static boolean isNumeric(String str) {
for (int i = str.length(); i = 0;) {
int chr = str.charAt(i);
if (chr 48chr 57)
return false;
}
return true;
}
public static boolean isNumeric(String str) {
for (int i = str.length(); i = 0;) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
public static boolean isNumeric(String str) {
Pattern pattern = Pattern.compile("[0-9]*");
return pattern.matcher(str).matches();
}
public static boolean isNumeric(String str) {
if (str.matches("““d*")) {
return true;
}
return false;
}
public static boolean isNumeric(String str) {
for (int i = str.length(); i = 0;) {
int chr = str.charAt(i);
if (chr 48chr 57)
return false;
}
return true;
}
相关文章推荐
- java中判断字符串是否为数字的三种方法
- java判断字符串是否为数字
- Java中判断字符串是否为数字的五种方法
- JAVA判断字符串是否为数字
- JAVA判断字符串是否为数字
- java判断字符串是否为数字
- java中判断字符串是否为数字的方法
- java判断字符串是否为数字或中文或字母
- JAVA判断字符串是否为数字
- java中判断字符串是否为数字的方法
- java中判断字符串是否为数字的方法 StringUtil包函数
- java中判断字符串是否为数字的方法的几种方法
- java中判断字符串是否为数字的方法的几种方法
- java中判断字符串是否为数字的方法的几种方法
- java中判断字符串是否为数字的方法的几种方法
- java中判断一个字符串是否“都为数字”和“是否包含数字”和“截取数字”
- [转]java中判断字符串是否为数字的三种方法
- Java中判断字符串是否为数字的五种方法
- java中判断字符串是否数字的两种方法
- Java中判断字符串是否为数字的五种方法