std.string will get the boot
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Jan 29 13:26:04 PST 2010
Ali Çehreli wrote:
> 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.
My thoughts exactly. In fact I'm thinking of generalizing toupper and
tolower for strings to take an optional trie mapping strings to strings.
That way correct capitalization can be done for any string, given a good
collection of capitalization patterns.
Andrei
More information about the Digitalmars-d
mailing list