开发者

Does there exist a analogue of the stringsearch package for Data.Text instead of ByteString?

开发者 https://www.devze.com 2023-03-23 13:00 出处:网络
The stringsearch package provides fast find/replace functionality for Haskell ByteStrings. Does there exist corresponding functionality for the text strings defined in the Data.Text package?

The stringsearch package provides fast find/replace functionality for Haskell ByteStrings. Does there exist corresponding functionality for the text strings defined in the Data.Text package?

The only approaches I can see at the moment involve encoding to UTF8, using stringsearch, and then converting back---which isn't real开发者_如何学运维ly ideal!


Efficient Boyer-Moore search for Text is implemented in the package out of the box. See the source here: http://hackage.haskell.org/packages/archive/text/0.11.1.5/doc/html/src/Data-Text-Search.html

Access to this functionality is through the standard Text API -- splitOn, breakOn, count, replace, and isInfixOf in particular.

0

精彩评论

暂无评论...
验证码 换一张
取 消