Skip to main content

stoi

Convert a string to an integer.

stoi("123", 10); //123
stoi("0xff", 16), //255

Syntax

stoi(string, base)

Returns

  • The string as an integer on success.
  • Undefined when the string cannot be converted.