On Thursday, 29 March 2018 at 20:29:39 UTC, aerto wrote:
how i can convert Hello world! to hex 48656c6c6f20776f726c6421 ??

Maybe something like:

void main() {
// Those look like lots of imports but most of those are very common anyway
    import std.digest: toHexString;
    import std.stdio: writeln;


    string s = "Hello world!";
    (cast(ubyte[]) s)    // We want raw bytes...
        .toHexString     // ...convert them to hex...
        .writeln;        // ...and print.
}

Reply via email to