Angelscript - cast string to int

301 views Asked by At

I could use some help. How do I explicity convert a string to an int.

Here is an example of what I would like to have working:

string string_num = "" + 1;

int num = cast(string_num);

I've tried searching the internet using the following:

"angelscript convert string to int"

"angelscript cast string to int"

"angelscript dictionary keys to int"

Help would be appreciated.

1

There are 1 answers

2
Max Hay On BEST ANSWER

https://www.angelcode.com/angelscript/sdk/docs/manual/doc_script_stdlib_string.htm

int64 parseInt(const string &in str, uint base = 10, uint &out byteCount = 0)

so to convert, you'd just call parseInt("1").

Converting from a string to a number is most often described as "parsing" which might be why your searches weren't coming up with anything.