java 判断字符串是否为数字

str.matches("\\d+")

如果值是true

Integer.parseInt(str);就可以转为int了

猜你喜欢

转载自www.cnblogs.com/jnhs/p/11639526.html