Checking, whether string contains only ascii.

berni via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 23 00:34:53 PST 2017


On Wednesday, 22 February 2017 at 21:23:45 UTC, H. S. Teoh wrote:
> 	enforce(!s.any!"a > 127");

Puh, it's lot's of possibilities to choose of, now... I thought 
of something like the foreach-loop but wasn't sure if that is 
correct for all utf encodings. All in all, I think I take the 
any-approach, because it feels a little bit more like looking at 
the string at a whole and I like to use enforce.

Thanks for all your answers!



More information about the Digitalmars-d-learn mailing list