Answers for "check if value is int"

2

how to check if number is integer in java

if(x == (int)x){
 println("x is an integer");
}
Posted by: Guest on October-28-2020
0

determine if is string or int

string str = "3257fg";
for(int i = 0;i < (strlen(str) - 1);i++) {
    if((int)str[i] < 10) {
        // it is a number, so do some code
    } else {
        // it is not a number, do something else
    }
}
Posted by: Guest on September-23-2021

Code answers related to "check if value is int"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language