isAsciiString in Phobos?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Mon Oct 7 08:17:57 PDT 2013
If I want to transfer some string to a C function that expects
ascii-only string. What can I use to verify there are no non-ascii
characters in a D string? I haven't seen anything in Phobos.
I was thinking of using:
bool isAscii = mystring.all!(a => a <= 0xFF);
Is this safe?
I'm thinking of whether a code point can consist of two code units
such as [C1][C2], where C2 may be in the range 0 - 0xFF. I don't know
if that's possible (not a unicode pro here..).
More information about the Digitalmars-d-learn
mailing list