Jacob Carlborg wrote:

> I would keep std.string for string specific functions and perhaps
> publicly import std.algorithm. For exmaple functions like: tolower, icmp
> and toStringz.

I've been thinking about characters lately and have realized that tolower, toupper, icmp, and friends should not be in a string library. Those functions need an "alphabet" to be useful; not language, nor locale...

In fact, the character itself must have alphabet information. Otherwise a string like "ali & jim" cannot be converted to upper-case correctly(*) as "ALİ & JIM". And the word "correctly" there depends on each character's alphabet.

Similarly, two characters that look the same cannot be compared for ordering. Comparing the 'x' of one alphabet to the 'x' of another alphabet is a meaningless operation.

Ali

Reply via email to