String_to_tuple
Chandrashekhar Mullaparthi
Chandrashekhar.Mullaparthi@REDACTED
Wed Jul 30 12:12:14 CEST 2003
5> String = "{a,b,c}.".
"{a,b,c}."
6>
6> {ok, Term, _} = erl_scan:string(String).
{ok,[{'{',1},{atom,1,a},{',',1},{atom,1,b},{',',1},{atom,1,c},{'}',1},{dot,1
}],1}
7>
7> erl_parse:parse_term(Term).
{ok,{a,b,c}}
8>
8>
> -----Original Message-----
> From: Rudolph van Graan [mailto:rvg@REDACTED]
> Sent: 30 July 2003 10:52
> To: erlang-questions@REDACTED
> Subject: String_to_tuple
>
>
> Hi all,
>
> I have another question today... I was digging through the
> documentation
> yesterday trying to find a function that basically does this:
>
> 1. Takes as input a string [eg. "{a,b,c}"] and
> 2. Outputs a term {a,b,c}
>
> I did quickly look at the erl_parse and erl_scan functions, but didn't
> find anything that seems to be able to do this. Basically it is the
> reverse of
>
> io_lib:format("~w",[Term])
>
> that I am looking for... I thought there might be a string_to_tuple or
> string_to_term function, but no luck for me.
>
> Anyone that knows of a simple way to do this?
>
> Rgds,
>
> R
>
NOTICE AND DISCLAIMER:
This email (including attachments) is confidential. If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents. We cannot accept liability for any breaches of
confidence arising through use of email. Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions. We will not accept responsibility for any commitments
made by our employees outside the scope of our business. We do not warrant
the accuracy or completeness of such information.
More information about the erlang-questions
mailing list