标签:cat aaaaa match span 识别 ring mat 字符 void
public class test { public static void main(String[] args) { String s = "225"; s=s.concat("\n").concat("aaaaa"); if (s != null && s.matches("^[0.0-9.0]+$")) {// [0-9]没办法识别小数,[0.0-9.0]可以识别小数和整数 System.out.println("输入是数字!"); double num = Double.parseDouble(s); System.out.println(num); } else { System.out.println("输入值为字符!"+s); } } }
标签:cat aaaaa match span 识别 ring mat 字符 void
原文地址:https://www.cnblogs.com/boshen-hzb/p/9015727.html