1. Convert a string to an integer
- Posted by drifter Dec 14, 2020
- 815 views
Hello, how does one convert a string to an int? Like typecasting?:
something like to_integer("34")
thx
2. Re: Convert a string to an integer
- Posted by irv Dec 14, 2020
- 807 views
One way:
include std/convert.e atom x = to_number("1234") -- or integer x = to_integer("123")
Another, slightly more work:
include std/get.e object x = value("1234") -- x will be a sequence of two numbers: {GET_SUCCESS,1234} if x[1] = GET_SUCCESS then x = x[2] end if
3. Re: Convert a string to an integer
- Posted by drifter Dec 14, 2020
- 804 views
ok perfect thanks! convert.e is what I was looking for