Hi all, this simple code to check number that I wrote with java code.
public boolean isNumeric(String st){
try{
double d = Double.parseDouble(st);
}catch(NumberFormatException e){
return false;
}
return true;
}
Please enjoy and sharing your ideas!
Monday, September 29, 2014
How to check dot(.) in java code
Hi everyone, today I want to show you how to check dot(.) by using java code. The purpose of this code, we want to allow dot one time when we trigger it. example like calculator ...
Please enjoy with my code and then pls you help to comment me to improve our knowledge each other. Thanks Advance!
public boolean checkDot(String st){
char ch[] = st.toCharArray();
for(int i=0;i<ch.length;i++)
if(ch[i] =='.')
return true;
return false;
}
This code, I allow to pass arguments as String. But you can modify it by your needs. Thanks!
Please enjoy with my code and then pls you help to comment me to improve our knowledge each other. Thanks Advance!
public boolean checkDot(String st){
char ch[] = st.toCharArray();
for(int i=0;i<ch.length;i++)
if(ch[i] =='.')
return true;
return false;
}
This code, I allow to pass arguments as String. But you can modify it by your needs. Thanks!
Subscribe to:
Comments (Atom)