Ali Çehreli:

    writefln("0x%(%x%)", a);

But usually I prefer to show all the zero nibbles:

void main() {
    import std.stdio;
    ubyte[] a = [10, 16, 32, 123];
    writefln("0x%(%02x%)", a); // Output: 0xa10207b
    static assert(is(typeof(a[0]) == ubyte), "Only ubyte[]");
    writefln("0x%(%x%)", a);   // Output: 0x0a10207b
}

Bye,
bearophile

Reply via email to