This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Quesiton regarding Java Property  RSS feed

 
Aditya Sirohi
Ranch Hand
Posts: 93
Eclipse IDE Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a properties file with a value:-

IZ_NOTIFICATION_EXP=30

I my code i do:-
String notiExp = getProperty("IZ_NOTIFICATION_EXP") and then do
Integer.parseInt(notiExp); to use it as an integer value.


My question is what if some one passes the value of the property as IZ_NOTIFICATION_EXP="30", i.e a String. How do i validate if the user passed a String and if user passed a String i can do certain operations?

-Aditya
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ask yourself this question. Is the data stored in the properties file text? Can it be stored as an int or any other non text type?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!