On Sunday, 27 October 2013 at 08:14:30 UTC, Nicolas Sicard wrote:
I don't think so. It's indeed worth noticing that Phobos' algorithms work with Unicode nicely, but: a) working on indices is sometimes the actual functionality you need
It is a means to an end. I'm saying it can be replaced with a much superior approach.
b) you need to allocate a new string from the range they return (the slice functions in this thread don't)
That's only the case with strictly lazy algorithms. The algorithms I pointed out are eager.
c) do they really handle grapheme clusters? (I don't know)
Rendering code and such is just about the only domain that needs to parse grapheme clusters. However, that doesn't mean that naive string manipulation code that uses indices can't break the string horribly before sending it off to rendering.