
1 Mar
2007
1 Mar
'07
7:02 a.m.
Hello, I wrote the following split function for Strings: splitS :: String -> String -> [String] splitS a b = splitA a b where z = length b - 1 splitA [] _ = [""] splitA (c:cs) (d:ds) | c == d && fst s == ds = "" : splitA (snd s) b | otherwise = (c : head r) : tail r where r = splitA cs b s = splitAt z cs example: splitS "Test;Hello;+123.5;+ 7" ";+" -> ["Test;Hallo","123.5"," 7"] How could it be optimized on speed? Does there exist already an optimized split for the conventional String type? -- Thanks in advance for your answer. h.