String to tuple

Carlos Varela Paz <>
Fri Jun 30 12:16:23 CEST 2006


El Viernes, 30 de Junio de 2006 03:56, paul escribió:
> Hi,
>
> I'm trying to convert a string in to a tuple, or a list of tuples.  Eg.
> From:
> A="{aa, bb}".
> to:
> B={aa, bb}.
>
> Any ideas?

That's what I do:

{ok, ItemTokens, _} = erl_scan:string(String ++ "."),
{ok, Term} = erl_parse:parse_term(ItemTokens),

Regards,
Carlos



More information about the erlang-questions mailing list