[erlang-questions] Split string in nested list

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Fri Feb 11 18:02:40 CET 2011

On Fri, Feb 11, 2011 at 17:50, shk <kuleshovmail@REDACTED> wrote:

> I have list of next view:
> [["admin@REDACTED"],[localhost@REDACTED],[user@REDACTED]]

I assume you mean that localhost@REDACTED is a string and not an atom
in the following:

5> [string:tokens(S, "@") || [S] <-

But you may want to pull out the underlying strings out of the lists
first depending on what you are trying to do. In the above we use a
list comprehension under the *assumption* that its elements are of the
form [S] for some S which is a string. It will fail silently if they
are not and skip the element. Also string:tokens/2 is under the
assumption there are no double occurrence of an @ character in the


More information about the erlang-questions mailing list