[erlang-questions] Split string in nested list

Weerasak Chongnguluam <>
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,[[""],[],[]]
    ).
    
On Fri, 2011-02-11 at 08:50 -0800, shk wrote:
> Hello,
> 
> I have list of next view:
> 
> [[""],[],[]]
> 
> 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