Answers for "check if value is a int"

0

java check if int

//"% (modulo)" calulates the remainder when the value on the left is divided by the value on the right

float number = 20;

if(number%1 == 0){
	println("It is an integer");
} else {
	println("It is not an integer");
}
Posted by: Guest on June-15-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 a int"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language