File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How to check whether the entered value is what type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to check whether the entered value is what type" Watch "How to check whether the entered value is what type" New topic
Author

How to check whether the entered value is what type

chenna reddy
Greenhorn

Joined: Sep 13, 2009
Posts: 5
Hello,

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

regards,
Naresh
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

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


SCJP 5.0 SCWCD 5.0
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36486
    
  16
And welcome to JavaRanch
chenna reddy
Greenhorn

Joined: Sep 13, 2009
Posts: 5
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?
Ranveer K Kumar
Ranch Hand

Joined: Sep 13, 2009
Posts: 64
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
Sheriff

Joined: Oct 13, 2005
Posts: 36486
    
  16
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

Joined: Sep 13, 2009
Posts: 5
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
Sheriff

Joined: Oct 13, 2005
Posts: 36486
    
  16
You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to check whether the entered value is what type
 
Similar Threads
How to check entered value is of which primitive type?
Type cheking using regex
Problem with Tokenizer
jspinner minimum value
regex to check valid long value.