Phobos strings versus C++ Boost

Michel Fortin michel.fortin at michelf.ca
Sat Jan 11 04:47:18 PST 2014


On 2014-01-11 07:50:54 +0000, "Brad Anderson" <eco at gnuk.net> said:

> 1. They have case-insensitive versions of pretty much everything.
> It's not hard to do a map!toLower/toUpper in D but it's also not
> obvious (nor do I know if that's actually correct in languages
> outside of english).

Uppercase, lowercase, and case-insensitive comparison is 
locale-dependent for Unicode. In the general case you can't just 
compare the lowercase/uppercase versions. For instance, look at the 
Turkish i/İ and ı/I (dot-less i), or the German ß/SS ss/SS pairs. Also, 
if you're sorting in alphabetical order you probably want to do 
something special with diacritics.

The correct way to to this is to implement the Unicode Collation Algorithm:
http://www.unicode.org/reports/tr10/

-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca



More information about the Digitalmars-d mailing list