[erlang-questions] Convert String to Integer

68 views
Skip to first unread message

Lucky Khoza

unread,
Nov 13, 2012, 9:32:39 AM11/13/12
to erlang-q...@erlang.org
Hi Erlang Developers,

How do i convert string to integer in Erlang, for example; "123" to 123.


Kindest Regards
Lucky

Artem Teslenko

unread,
Nov 13, 2012, 9:34:00 AM11/13/12
to Lucky Khoza, erlang-q...@erlang.org
Hi,

1> list_to_integer("123").
123
> _______________________________________________
> erlang-questions mailing list
> erlang-q...@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Dmitry Belyaev

unread,
Nov 13, 2012, 9:36:50 AM11/13/12
to Lucky Khoza, erlang-q...@erlang.org
erlang:list_to_integer/1

-- 
Dmitry Belyaev

Michael Uvarov

unread,
Nov 13, 2012, 9:37:55 AM11/13/12
to Lucky Khoza, erlang-q...@erlang.org
1. list_to_integer("111").
111

2. There are no strings in Erlang as a special type, "111" is a list.

Wes James

unread,
Nov 13, 2012, 10:55:14 AM11/13/12
to Michael Uvarov, erlang-q...@erlang.org
There may not be technically strings, but there is a module with "string" funs:


wes

Richard O'Keefe

unread,
Nov 13, 2012, 4:59:12 PM11/13/12
to Lucky Khoza, erlang-q...@erlang.org

On 14/11/2012, at 3:32 AM, Lucky Khoza wrote:

> Hi Erlang Developers,
>
> How do i convert string to integer in Erlang, for example; "123" to 123.

It is a good idea to search for an answer before asking
a question on a mailing list. In this case, Googling for
"convert string to integer" Erlang
found
http://osdir.com/ml/erlang-questions-programming/2003-03/msg00177.html
in seconds.

Doing such a search saves everyone's time, including yours.
Reply all
Reply to author
Forward
0 new messages