Ascii string literal.

Alexandru Ermicioi via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 6 13:01:27 PDT 2016


Good day,

Is it possible somehow to convert implicitly a string literal 
into an ubyte array?
For example:

void do(immutable(ubyte)[] asciiString) {
// Do something with ascii string.
}

And from another section of code, calling it like:

do("Some ascii string");
-----------

If no, is there an us-ascii string literal that consists of 
ubytes and not chars?

It's just in some of my code should work only with ascii strings, 
and it will be cumbersome to convert to ubyte array a string 
literal each time a function accepting an ubyte array is called.

Thank you.


More information about the Digitalmars-d-learn mailing list