Check if the value is an integer (Objective-C)

How to check if my value is integer or not?
I want something like this:


if ( i/split != int )  {...}

Thank,

+3
source share
2 answers

I'm not sure, but I think you are trying to figure out if the result of the break is an integer. You can use the module operator% to get the remainder of the division operation.

Assuming that iboth splitare integer types (int, long, short, etc.), then the module returns 0 when ior splitis an integer value, that is:

if ( i % split == 0 ) {...}
+8
source

Just use the objCType method? Documents

+1

Source: https://habr.com/ru/post/1736437/


All Articles