[erlang-questions] Split string in nested list

James Aimonetti <>
Fri Feb 11 18:05:28 CET 2011


On 02/11/2011 08:50 AM, 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.
Is the list ["", "", ""] 
or the one you wrote? They are different; yours is a list of lists, each 
of which is a list with one element (the string), while mine is a list 
of strings.

Either way, lists:map/2 should suffice to help convert the list; you 
will need to unpack your inner lists within the map fun to get your 
actual string.

-- 
James Aimonetti
Distributed Systems Engineer / DJ MC_

2600hz | http://2600hz.com
sip:
tel: 415.886.7905



More information about the erlang-questions mailing list