Erlang : flattening a list of strings

Posted by ErJab on Stack Overflow See other posts from Stack Overflow or by ErJab
Published on 2010-05-26T08:53:34Z Indexed on 2010/05/26 9:21 UTC
Read the original article Hit count: 261

Filed under:
|
|

I have a list like this:

[["str1","str2"],["str3","str4"],["str5","str6"]]

And I need to convert it to

["str1", "str2", "str3", "str4", "str5", "str6"]

How do I do this?

The problem is that I'm dealing with lists of strings, so when I do

lists:flatten([["str1","str2"],["str3","str4"],["str5","str6"]])

I get

"str1str2str3str4str5str6"

However, if the elements of the original list where just atoms, then lists:flatten would have given me what I needed. How do I achieve the same with strings?

© Stack Overflow or respective owner

Related posts about list

Related posts about erlang