[Haskell-cafe] Searching of several substrings (with Data.Text ?)
Tillmann Vogt
Tillmann.Vogt at rwth-aachen.de
Tue Jul 5 20:01:26 CEST 2011
Hi,
For my font library I need A function that can handle ligatures. It can
be explained best with an example:
f ["Th", "ff", "fi", "fl", "ffi"] "The fluffiest bunny"
should be evaluated to
["Th", "e", " ", "fl", "u", "ffi", "e", "s", "t", " ", "b", "u", "n",
"n", "y" ]
I looked at Data.Text
http://hackage.haskell.org/packages/archive/text/0.5/doc/html/Data-Text.html
and
http://hackage.haskell.org/packages/archive/stringsearch/0.3.3/doc/html/Data-ByteString-Search.html
but they don't have a function that can search several substrings in one
run.
I guess that searching a text again and again for every substring is not
very efficient and it can be done in one run.
Although I may figure this out myself I think such a function could be
so common that someone has done it or can give me some tips.
Thanks
More information about the Haskell-Cafe
mailing list