STOI is a CAOS command which converts between strings and integers.


Syntax: STOI str (string)

Returns the integer made from converting str. str is in the format [whitespace][+|-][nn] where [nn] may be any length. In the event of an error 0 is returned.

If str corresponds to something outside the integer range (which is -2^{31} \le n < 2^{31}) the numbers wrap, so STOI "21474835648" == -2147483648. Note that this behaviour is different to the CEE's when such numbers are found in injected code.

If a string of the above format begins str but something is attached to the end, the string is truncated at the end of the well-formatted portion. Note that this means a string representing a float will be truncated instead of rounded. (Hence, STOI VTOS va00 is a roundabout way to get floor(va00).)

This command is exactly equivalent to C's atoi() function.


OUTV STOI "    1234"
OUTV STOI "1234.5"
OUTV STOI "  123456, I say!"
OUTV STOI "Hello!"

See also

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.