How to check if a double number has zero after the point; if it has, then convert it to an int number.
For example:
- if the number = 13.0 … convert to 13
- if the number = 144.0 … convert to 144
How to check if a double number has zero after the point; if it has, then convert it to an int number.
For example:
Here is your number's variable
var number = 13.0
you can simply perform:
var newNumber;
if (number is int) {
newNumber = number.toInt();
}
double a=144.0;
print(a..ceilToDouble()); //must ..
Output
144.0 -> 144
144.1 -> 144.1