
Am Dienstag, 26. August 2008 17:43 schrieb Rafael Gustavo da Cunha Pereira Pinto:
Two quick questions:
1) Is there any replacement for the (now deprecated) findSubstring function on ByteString.Char8? 2) Does it work with ByteString.Lazy.Char8?
Best Regards,
Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc.
Use the stringsearch package: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/stringsearch That has pretty fast stringsearch functions (usually, Boyer-Moore is faster than Knuth-Morris-Pratt) for strict and lazy ByteStrings. I'm not sure if it works on ByteString(.Lazy).Char8, too, or only on Word8 ByteStrings, but it would be trivial to adapt, just change the import. There's one thing to be aware of, however, if there are overlapping occurences of the searched-for string, KMP reports only the first of their indices, BM all. Maybe we should complete it and also add search&replace functions? Cheers, Daniel