t****o 发帖数: 181 | 1 In Java, how to validate whether the input is a number or not? Thanks. | g*****g 发帖数: 34805 | 2 What kind of Number? For simple one, a try and catch
Integer/Double of parseInt/parseDouble may be enough,
for complicated one, check NumberFormat
【在 t****o 的大作中提到】 : In Java, how to validate whether the input is a number or not? Thanks.
| a**e 发帖数: 5794 | 3 boolean isDigit(char)
【在 t****o 的大作中提到】 : In Java, how to validate whether the input is a number or not? Thanks.
| c*z 发帖数: 62 | 4 use regular expression
【在 t****o 的大作中提到】 : In Java, how to validate whether the input is a number or not? Thanks.
|
|