isinteger

How to check if a number is an integer in .Net?

Say I've got a string which contains a number. I want to check if this number is an integer. Example IsInteger("sss") => false IsInteger("123") => true IsInterger("123.45") =>false ...

What is the most reliable way of checking if a floating point variable is an integer?

I can think of several ways, eg. Convert.ToInt32(floatingPoint) - floatingPoint == 0; Math.Truncate(floatingPoint) - floatingPoint == 0; floatingPoint % 1 == 0; Math.Floor(floatingPoint) == floatingPoint; //etc... But which method is most reliable? ...

PHP: Variable is int but can't perform calculation

$bal = (int)$balance; echo is_int($bal); $balance is from a file_get_contents($webservice); I am using (int) to convert a string to integer. is_int returns 1 for true as verification. Because the value of $bal is always negative, I do the following calculation to make it a positive: $bal = $bal * -1; When I do this, the value bec...