/**
* 判断字符创是否为空
* @param str 字符串
* @return boolean
*/
public static boolean isEmpty(String str){
String regex="[^\\s]{1,}";
return str.matches(regex);
}
/**
* 判断字符创是否为数字
* @param str 字符串
* @return boolean
*/
public static boolean isNumber(String str){
String regex="[0-9]*";
return str.matches(regex);
}
/**
* 判断字符创是否为浮点数
* @param str 字符串
* @return boolean
*/
public static boolean isDouble(String str){
String regex="[\\d]+\\.[\\d]+";
return str.matches(regex);
}
/**
* 判断字符创是否为正整数
* @param str 字符串
* @return boolean
*/
public static boolean isInt(String str){
String regex="/^[1-9]+\\d*$";
return str.matches(regex);
}
/**
* 判断字符创是否为手机号
* @param str 字符串
* @return boolean
*/
public static boolean isPhone(String str){
Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
Matcher m = p.matcher(str);
return m.matches();
}
/**
* 判断字符创是否为邮箱
* @param str 字符串
* @return boolean
*/
public static boolean isEmail(String str){
Pattern p = Pattern.compile("^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$");
Matcher m = p.matcher(str);
return m.matches();
}
public static void main(String[] args) {
System.out.println(Regex.isDouble("1"));
}