开发者

Easy way to see if an input is an integer?

开发者 https://www.devze.com 2023-02-14 00:09 出处:网络
Is there a simple way to see if an input 开发者_如何学Pythonis an integer in Java?try { Integer.parseInt(myString);

Is there a simple way to see if an input 开发者_如何学Pythonis an integer in Java?


try {
  Integer.parseInt(myString);
} catch(NumberFormatException e) {
  // Not an integer
}

Documentation for parseInt() if you're interested.

0

精彩评论

暂无评论...
验证码 换一张
取 消