Re: Convert a string to an integer

new topic     » goto parent     » topic index » view thread      » older message » newer message

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 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu