String regex = "([1-9]{1,}|(\\d+.{1}\\d+)|0{1})";// 判断是否数字或小数点
//
while (true) {
System.out.println("please input value:");
Scanner scanner = new Scanner(System.in);
String next = scanner.next();
System.out.println(Pattern.matches(regex, next));
}
小数点或数字正则
最新推荐文章于 2025-03-31 22:48:13 发布
1万+

被折叠的 条评论
为什么被折叠?



