Byte Array Literal

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 9 12:06:14 PDT 2014


On Thu, 09 Oct 2014 15:26:52 +0000
Anibal via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:

additionally to all bearophile said, there is another interesting thing
in D: special string literals for hex data.

  immutable ubyte[] n = cast(typeof(n))x"deadf00d";

or even:

  immutable ubyte[] n = cast(typeof(n))x"de ad f 0 0 d";

spaces doesn't matter, only digits do.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141009/d8e2d4f7/attachment.sig>


More information about the Digitalmars-d-learn mailing list