如题所述
两种方式,一种是用正则判断,二种是直接用int.TryParse进行格式化,如果格式化不成功,就是非数字.
错误
手敲的,掉了一个参数int result = -1;if(!int.TryParse(req,out result))