substring search api

Malcolm Wallace Malcolm.Wallace at
Tue Sep 18 11:23:56 EDT 2007

haskell at wrote:

> Users may very well need the offsets, though.
> That means one needs to call some "length" function to get the
> offsets.

'length' of a ByteString is extremely cheap.

>  This requires forcing the whole input string to get the
> length of the second found location.

I don't see why it should force the whole input: only as much as is
needed to find the desired substring.  There is no need to call 'length'
on the tail, since it doesn't yield any interesting information.


More information about the Libraries mailing list