How to convert this string format "{hari, localost}"
into this: {"hari", "localost"}
, in Erlang?
I tried to convert this format with lot of trial and error method, but I can't get the solution.
How to convert this string format "{hari, localost}"
into this: {"hari", "localost"}
, in Erlang?
I tried to convert this format with lot of trial and error method, but I can't get the solution.
I guess you need to convert from string, so you can use the modules erl_scan and erl_parse:
Note 1 the function erl_parse:parse_term/1 will work only if Terms is a valid expression, it is why I had to add a "." at the end of the input.
Note 2 yo can directly transform to the final expression if you quote the terms in the input expression: