[erlang-questions] splitting string into to substring

Andrew Stone stondage123@REDACTED
Thu Sep 11 01:51:22 CEST 2008


You can try string:tokens()

-Andrew



----- Original Message ----
From: Yunita C <l1nk2306@REDACTED>
To: erlang-questions@REDACTED
Sent: Wednesday, September 10, 2008 6:19:07 PM
Subject: [erlang-questions] splitting string into to substring


Hi All, 

I am new to erlang and I want to write Erlang function that given a
string and a pattern and uses the pattern to split the string into like
this: 

For example if the pattern is "ab" and the string is "acabcabts" the code will return ["ac", "cabts"]. 

If the pattern is "bc" and the string is "bcad" the code returns ["", ad]. 

If the pattern is "ac" and the string is "bcad" the code will return ["bcad", ""]. 

I'm trying to make function using  list but still stuck there. Can anybody help me? Thank's so much. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080910/7ffdfaff/attachment.htm>


More information about the erlang-questions mailing list