[erlang-questions] Split string in nested list
Weerasak Chongnguluam
singpor@REDACTED
Fri Feb 11 18:08:45 CET 2011
Hi,
You can use lists:map with string:tokens, like this.
lists:map(fun(URL) ->
if is_atom(URL) ->
string:tokens(atom_to_list(URL),"@");
true ->
string:tokens(URL,"@")
end
end,[["admin@REDACTED"],[localhost@REDACTED],[user@REDACTED]]
).
On Fri, 2011-02-11 at 08:50 -0800, shk wrote:
> Hello,
>
> I have list of next view:
>
> [["admin@REDACTED"],[localhost@REDACTED],[user@REDACTED]]
>
> How can i split by '@" this list?
>
> I need following:
>
> [["admin", "localhost"], ["localhost", "localhost"], [user, localhost]]
>
> Thank you.
More information about the erlang-questions
mailing list