Compare string with German umlauts

Martin Tschierschke mt at smartdolphin.de
Tue May 19 08:03:29 UTC 2020


On Monday, 18 May 2020 at 14:28:33 UTC, Steven Schveighoffer 
wrote:
> On 5/18/20 9:44 AM, Martin Tschierschke wrote:
>> [...]
>
> using == on strings is going to compare the exact bits for 
> equality. In unicode, things can be encoded differently to make 
> the same grapheme. For example, ö is a code unit that is the o 
> with a diaeresis (U+00F6). But you could encode it with 2 code 
> points -- a standard o, and then an diaeresis combining 
> character (U+006F, U+0308)
>
> What you need is to normalize the data for comparison: 
> https://dlang.org/phobos/std_uni.html#normalize
Thank you, I will check that.



More information about the Digitalmars-d-learn mailing list