20表示数值的字符串

public class Test20 {
    public static void main(String[] args) {
        String str = "-12.4e-10";
        String patten = "[\\-\\+]?\\d+(\\.\\d+)?([eE][\\+\\-]?\\d+)?";  //正则表达式
        System.out.println(str.matches(patten));
    }
}

发布了41 篇原创文章 · 获赞 1 · 访问量 773

猜你喜欢

转载自blog.csdn.net/coder_my_lover/article/details/105237871
今日推荐