String to term
Raimo Niskanen
raimo@REDACTED
Wed Apr 27 15:12:27 CEST 2005
Not that simple, but...
{ok,Tokens,_EndLine} = erl_scan:string("{1,2,[hello]}."),
{ok,AbsForm} = erl_parse:parse_exprs(Tokens),
{value,Value,_Bs} = erl_eval:exprs(AbsForm, erl_eval:new_bindings()),
Value.
... to parse expressions. (Note the trailing dot in the input string)
erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) writes:
> Hi,
>
> Does someone know if there is an easy way to convert a string to an Erlang
> term?
> example:
> "{1,2,[hello]}" ---- converted to -----> {1,2,[hello]}
>
>
> thanks in advance,
> Eduardo Figoli
> INSwitch Solutions
>
>
>
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-questions
mailing list