Converts the specified object to Integer according to the rules:

Examples:


toInt(2)      ==  2
toInt(3.4)    ==  3
toInt("-3.4") == -3
toInt(true)   ==  1
toInt(false)  ==  0
Tip:

You may call this function in a more method-like style:

obj.toInt()