package cn.temptation.util;

import java.util.regex.Pattern;

public class TypeUtil {
    /**
     * 验证是否整数
     * @param str
     * @return
     */
    public static boolean isNum(String str) {
        Pattern pattern = Pattern.compile("^-?[0-9]+");
        if (pattern.matcher(str).matches()) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * 验证是否小数
     * @param str
     * @return
     */
    public static boolean isNumEx(String str) {
        Pattern pattern = Pattern.compile("^[-+]?[0-9]+(\\.[0-9]+)?$");

        if (pattern.matcher(str).matches()) {
            return true;
        } else {
            return false;
        }
    }
}
最近下载更多
601601lmy  LV5 2023年10月20日
刘亦菲9527  LV15 2022年1月25日
c15042361021  LV4 2021年7月8日
woshicainiao2  LV4 2021年5月12日
caozongan  LV19 2021年3月10日
Qolmen  LV12 2020年12月22日
hidemoon  LV2 2020年11月25日
qa38113202  LV1 2020年9月14日
bianjun  LV1 2020年9月2日
hao895937469  LV4 2020年6月24日
最近浏览更多
killler 3月25日
暂无贡献等级
601601lmy  LV5 2023年10月20日
SDASDASDAD  LV1 2023年10月16日
漫步的海星  LV4 2023年9月21日
飞呀飞呀飞不放  LV7 2023年8月9日
hbsoft2008  LV16 2023年3月20日
xhjzsx0715  LV1 2023年3月11日
yohohero  LV1 2023年1月14日
liujiaxin666  LV1 2022年12月1日
内心向阳  LV4 2022年11月30日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友