Jass documentation Database

JASS Documentation Database REFORGED


Results for the query "S2I" as a "function"

The search keyword must be a single word (no spaces).

Function S2I

Line: 2230
Location: common.j
Constant? no
Type: native
Arguments: string s
Returns: integer

Preview

Extra spaces may have been removed from the original file to show the function in a comfortable way.
  1. native S2I takes string s returns integer

Information about S2I

Information contributed by City17
on February 25, 2022, 02:51:51 PM.
returns an integer by parsing the string for a number.
For values too big or too small, returns max/min integer respectively. For an empty string or text that doesn't start with a number, returns 0. For null raises an error.
The parser stops at the first non-number character [0-9.]

Examples (Lua):
Code: [Select]
S2I("") -- 0
S2I("-123") -- -123
S2I("-99999999") -- -2147483648
S2I("99999999") -- 2147483647
S2I("123abc") -- 123
S2I("abc123") -- 0
S2I(nil) -- error

Page loaded in 0.1158 seconds.
Vivir aprendiendo.co - A place for learning stuff, in Spanish   Chaos Realm - The world of Game modders and wc3 addicts   Diplo, a gaming community   Power of Corruption, an altered melee featuring Naga and Demon. Play it now!!!   WC3JASS.com - The JASS Vault + vJASS and Zinc   Jetcraft - A Starcraft II mod   WormTastic Clan (wTc)   Warcraft RESOURCES Reforged: Modelos, mapas, proyectos y mas...