[erlang-questions] splitting

Balathasan Sayanthan bsayanthan@REDACTED
Mon Mar 3 10:20:52 CET 2008


Hi ,

I am trying to write a decoding logic to decode a list which has a
predefined separator ( eg.  tab). But  the  distance at which the  separator
will occur from the start of the list is unknown. I want to extract all the
values before the separator into one list and the rest of the list into
another, what would be the best way of doing this in Erlang?

for example if the program is given a list like [ 23, 34,  9, 34, 78, 90, 9,
10, 34 ]

I want this to  be split into [23, 34] , [ 34, 78, 90, 9, 10, 34] using 9 as
the separator(the point at which will occur is a variable and aslo there
might be multiple occurances of it).

Am I supposed to use the string:tokens(*string*, *substring*), but is there
a more efficient way of doing it in Erlang?

-- 
Sayanthan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080303/eac0ecf2/attachment.htm>


More information about the erlang-questions mailing list