http://bytes.com/topic/java/answers/18107-test-if-string-integer

"dave" <go_away_you_spammer_scum@nowhere.com> wrote in message
news:FAHJc.59786$Xb4.4468@nwrdny02.gnilink.net...[color=blue]
> I am reading input from a form. I want to validate the input by making[/color]
sure[color=blue]
> that the string is actually an integer. How would I do this? Do i need to
> convert it to a character array and break down each character and test it?
> or is there an easier way? Thanks.
>[/color]

Try to perform Integer.parseInt(yourString) and if it throws a
NumberFormatException you'll know the string isn't a valid integer

相关文章:

  • 2022-12-23
  • 2021-09-17
  • 2021-07-28
  • 2022-02-27
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
猜你喜欢
  • 2022-02-14
  • 2021-06-08
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案