Check if a number has a decimal place/is a whole number

Hi Guys,

Is there any way to check the number has decimal places. I tried this ```
num % 1 != 0

but didn’t work with the if function.

Kindly requesting your help on this

Thanks and regards
charith

@charith_wickramasing

If YourNumber.toString.Contains(“.”)

Then its decimal number
else
Whole Number

5 Likes

Thanks @lakshman i’ll check and let you know.

1 Like

This is wrong, because there are countries using comma as a decimal separator. Use the below as test, with var2 being Double. (true=> integer, false=>decimal)

Math.Truncate(var2)=var2
7 Likes

Hey @c.ciprian,

Thanks a lot . it works :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.