Checking, whether string contains only ascii.

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 22 12:01:57 PST 2017


On Wednesday, 22 February 2017 at 19:26:15 UTC, berni wrote:
> herefore I'd like to make sure that the string the program read 
> is only made up of ascii characters.

Easiest:

foreach(char ch; postscript)
   if(ch > 127) throw new Exception("non-ascii detected");


More information about the Digitalmars-d-learn mailing list