[Haskell-cafe] How to split this string.

Christian Maeder Christian.Maeder at dfki.de
Wed Jan 4 19:18:06 CET 2012

Am 04.01.2012 17:47, schrieb Steve Horne:
> On 02/01/2012 11:12, Jon Fairbairn wrote:
>> max<mk at mtw.ru> writes:
>>> I want to write a function whose behavior is as follows:
>>> foo "string1\nstring2\r\nstring3\nstring4" = ["string1",
>>> "string2\r\nstring3", "string4"]
>>> Note the sequence "\r\n", which is ignored. How can I do this?

Why do you have these (unhealthy) different kinds of line breaks (Unix 
and Windows style) in your string in the first place?

I hope, not by something calling "unlines" (or intercalate "\n") earlier.

Cheers Christian

More information about the Haskell-Cafe mailing list