In java, you can do something like:
boolean isNumber(String in) {
for (int i=0; i<in.length; i++) {
if (in.charAt<'0'||in.charAt>'9') return false;
}
return true;
}
Putting a single character in single quotes is the same as using the ASCII code of that character - the above code checks if the ASCII code of each character in the string is not that of a numeric character.
C
carlio
@carlio
0
Reputation
1
Posts
17
Profile views
0
Followers
0
Following
Best posts made by carlio
This user hasn't posted anything yet.
Latest posts made by carlio
-
RE: Basic question: How to determine if a string is a number?