Table of strings sorting problem

John C johnch_atms at hotmail.com
Sat Mar 11 13:24:51 PST 2006


Aarti wrote:
> John C wrote:
> 
>> As others have implied, D's standard library isn't culturally aware.
>>
>> I've been working on a locale package for Mango that will eventually 
>> allow correct string sorting for specific languages. This is how you'd 
>> sort a list of Polish characters:
>>
>> const char[][] table = [ "a","ą","c","ć","e","ę" ];
>> Culture.current = Culture.getCulture("pl-PL");
>> table.sort();
> 
> 
> It would be really helpful! Does it already work? I especially don't 
> understand how can I change standard behaviour of table sort property?

Well, I've written an implementation that works, but it's not yet ready 
to be unleashed on the public.

It might be possible to override _adSort ... not tried it yet. Currently 
it's just a free function, which can be called as if an array property.

> 
> I think that internationalization support is one of most important areas 
> which could increase D acceptance all over the world.
> 
> Althrough in C++ it's not as easy as it should be, but it's still easier 
> than making own sort function. Especially when I want in my program that 
> sorting according to rules of _many_ different languages should be 
> supported.
> 
> Another problem is that D documentation does not say anything that D 
> sorts tables only in binary order. There should be also hint how to 
> implement own sorters for table, because now language does not behave as 
> expected in case of strings.
> 
> Regards
> Marcin Kuszczak



More information about the Digitalmars-d mailing list