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");
}
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");
}
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
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us