std.string inPattern() and UTF symbols

qznc qznc at web.de
Mon Dec 9 07:58:51 PST 2013


On Monday, 9 December 2013 at 14:44:23 UTC, Fra wrote:
> various (UTF) symbols seems to be ignored by inPattern, see 
> http://dpaste.dzfl.pl/e8ff9002 for a quick example (munch() 
> uses inPattern() internally)
>
> Is it me doing something in an improper way, or is the 
> documentation lacking more specific limitation of the function? 
> All I can read is "In the future, the pattern syntax may be 
> improved to be more like regular expression character classes". 
> This doesn't sound like "non-ascii symbols are not supported"

Looking at the implementation of inPattern [0], I'd say it is 
restricted to ASCII. The unittests only cover ASCII, for example.

I also smell a unicode bug, due to the combination of foreach and 
length.

[0] 
https://github.com/D-Programming-Language/phobos/blob/master/std/string.d#L2595


More information about the Digitalmars-d-learn mailing list