The Case Against Autodecode

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 2 14:46:52 PDT 2016


On 6/2/16 5:43 PM, Timon Gehr wrote:
>
> .̂ ̪.̂
>
> (Copy-paste it somewhere else, I think it might not be rendered
> correctly on the forum.)
>
> The point is that if I do:
>
> ".̂ ̪.̂".normalize!NFC.byGrapheme.findAmong([Grapheme("."),Grapheme(",")])
>
> no match is returned.
>
> If I use your method with dchars, I will get spurious matches. I.e. the
> suggested method to look for punctuation symbols is incorrect:
>
> writeln(".̂ ̪.̂".findAmong(",.")); // ".̂ ̪.̂"

Nice example.

> (Also, do you have an use case for this?)

Count delimited words. Did you also look at balancedParens?


Andrei


More information about the Digitalmars-d mailing list