File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question About Numberic

 
Yanxin Zhao
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi: everyone
I want to konw that how to make sure a int number is numberic tpye? in other words, which method can return a boolean value if I input a numberic value ? I mean a method can judge whether a value is a numberic value or not.
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to parse a String as an int value, then use the Integer.parseInt method. If it throws a NumberFormatException, then you know the String did not represent an int value.
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about
boolean Character.isDigit( char ch )
??
API
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's the best method if you are interested in testing a single char or testing the individual chars in a String.
 
Yanxin Zhao
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you all, my problem has been finished under your help. thinks so much.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yanxin, what did you end up doing?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic