On 3/9/14, 10:34 AM, Peter Alexander wrote:
If we assume strings are normalized then substring search, equality
testing, sorting all work the same with either code units or code points.

But others such as edit distance or equal(some_string, some_wstring) will not.

If you don't care about normalization then by code unit is just as good
as by code point, but you don't need to specialise everywhere in Phobos.

AFAIK, there is only one exception, stuff like s.all!(c => c == 'é'),
but as Vladimir correctly points out: (a) by code point, this is still
broken in the face of normalization, and (b) are there any real
applications that search a string for a specific non-ASCII character?

What happened to counting characters and such?

I can't think of any case where you would want to count characters.

wc

(Generally: I've always been very very very doubtful about arguments that start with "I can't think of..." because I've historically tried them so many times, and with terrible results.)


Andrei

Reply via email to