HTML Utilities

Showing help on 'toint()'

Syntax: toint (<value>) => INT
tonum (<value>) => INT

Converts the given MOO value into an integer and returns that integer. Floating-point numbers are rounded toward zero, truncating their fractional parts. Object numbers are converted into the equivalent integers, strings are parsed as the decimal encoding of a real number which is then converted to an integer. Errors are converted into integers obeying the same ordering (with respect to `<=' as the errors themselves.) `Toint()' raises E_TYPE if <value> is a LIST. If <value> is a string but the string does not contain a syntactically-correct number, then `toint()' returns 0.

toint(34.7) => 34
toint(-34.7) => 34
toint(#34) => 34
toint("34") => 34
toint("34.7") => 34
toint(" - 34 ") => -34
toint(E_TYPE) => 1



-- telnet://project-mongoose.net:7777 -- Mail us -- http://project-mongoose.net:7780/ --
-- Five users connected --