I think you want

Text.Regex.  splitRegex

or something very much like it.

http://haskell.org/hoogle/?q=String-%3E%5BString%5D

2007/3/1, h. <[EMAIL PROTECTED]>:
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.


_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to