• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to check whether the entered value is what type

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

How to check the entered value is of which primitive type?

regards,
Naresh
 
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chenna reddy wrote:

How to check the entered value is of which primitive type?



entered value ...? from where???
i didn't understand your problem. what i know if you are entering any data through keyboard or any textfield it will always be a string.
please make your question a bit more clear.
avi sinha
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to JavaRanch
 
chenna reddy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question is how to know whether the entered value is a string or int or float or char. Is there any specific method are there to know?
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

chenna reddy wrote:The question is how to know whether the entered value is a string or int or float or char. Is there any specific method are there to know?



Please lets know as avi sinha's asked from where you want to enter, for example in web the input values will string always..
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Determining whether a String like "Campbell" "123" or "123.45" can represent a number or an integer looks like a job for regular expressions. Whether the String "1" represents writing with a number in, an integer 1, a floating-point 1.0 or the character '1' is for you to decide.
You will find more about the Java™ grammar for such "primitives" in this Java Language Specification section.
 
chenna reddy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Determining whether a String like "Campbell" "123" or "123.45" can represent a number or an integer looks like a job for regular expressions. Whether the String "1" represents writing with a number in, an integer 1, a floating-point 1.0 or the character '1' is for you to decide.
You will find more about the Java™ grammar for such "primitives" in this Java Language Specification section.



Thank you.
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome
 
Don't MAKE me come back there with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic