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!
No comments:
Post a Comment