• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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: 76888
366
  • 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: 76888
366
  • 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: 76888
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic