On 02.06.2016 23:46, Andrei Alexandrescu wrote:
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.
...

Thanks! :o)

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

Count delimited words. Did you also look at balancedParens?


Andrei


On 02.06.2016 22:01, Timon Gehr wrote:

* s.balancedParens('〈', '〉') works only with autodecoding.
...

Doesn't work, e.g. s="⟨⃖". Shouldn't compile.

assert("⟨⃖".normalize!NFC.byGrapheme.balancedParens(Grapheme("⟨"),Grapheme("⟩")));

writeln("⟨⃖".balancedParens('⟨','⟩')); // false


Reply via email to