设为首页 加入收藏

TOP

开发中日常操作转化工具类(九)
2014-11-24 12:02:24 】 浏览:1916
Tags:开发 日常 操作 转化 工具
return checkID18(str);
}
else if (Util.test("^\\d{15}$", str))
{
return checkID15(str);
}
else
{
return false;
}
}*/
/*private static boolean checkID18(String str)
{
String year = str.substring(6, 2);
String month = str.substring(8, 2);
String day = str.substring(10, 2);
if (!Util.test("^\\d\\d$", year))
{
return false;
}
if (!isMonth(month))
{
return false;
}
if (!isDay(day))
{
return false;
}
if (Util.parseInt(month) == 2 && Util.parseInt(day) > FEB_DAYES)
{
return false;
}
return true;
}
private static boolean checkID15(String str)
{
String year = str.substring(ID15_YEAR, 4);
String month = str.substring(ID15_MONTH, 2);
String day = str.substring(ID15_DAY, 2);
if (!isYear(year))
{
return false;
}
if (!isMonth(month))
{
return false;
}
if (!isDay(day))
{
return false;
}
if (Util.parseInt(month) == 2 && Util.parseInt(day) > FEB_DAYES)
{
return false;
}
return true;
}*/
/**
*〈验证必须为数字〉
* @param str 待验证字符串
* @param prop prop
* @return boolean
*/
protected static boolean mustNum(String str)
{
if (Util.isEmpty(str))
{
return true;
}
return Util.test("^\\d+$", str);
}
/**
*〈体重验证〉
* @param str 待验证字符串
* @param prop prop
* @return boolean
*/
protected static boolean avoirdupois(String str)
{
if (Util.isEmpty(str))
{
return true;
}
return Util.test("^([3-9]\\d|1\\d\\d)(\\.\\d{0,2}) $", str);
}
/**
*〈验证身高〉
* @param str 待验证字符串
* @param prop prop
* @return boolean
*/
protected static boolean stature(String str)
{
if (Util.isEmpty(str))
{
return true;
}
return Util.test("^([89]\\d|[12]\\d\\d)(\\.\\d{0,2}) $", str);
}
/**
*〈验证年龄〉
* @param str 待验证字符串
* @param prop prop
* @return boolean
*/
protected static boolean age(String str)
{
if (Util.isEmpty(str))
{
return true;
}
return Util.test("^([1-9]|[1-9]\\d )$", str);
}
/**
*〈验证鞋码〉
* @param str 待验证字符串
* @param prop prop
* @return boolean
*/
protected static boolean shoeSize(String str)
{
if (Util.isEmpty(str))
{
return true;
}
return Util.test("(^[34]\\d$)|(^50$)", str);
}
/**
* 判断是否为数字,包含浮点型
* @param str
* @return
*/
public static boolean checkNum(String str)
{
if (Util.isEmpty(str))
{
return true;
}
return Util.test(
首页 上一页 6 7 8 9 下一页 尾页 9/9/9
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇数学运算工具类 下一篇利用JDBC连接取数据并导入到EXCEL..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目