Skip to content

Instantly share code, notes, and snippets.

@JakobOvrum
Created July 29, 2012 13:36
Show Gist options
  • Save JakobOvrum/3198842 to your computer and use it in GitHub Desktop.
Save JakobOvrum/3198842 to your computer and use it in GitHub Desktop.
byte array to hex string
import std.stdio;
import std.format;
import std.array;
void main()
{
ubyte[] data = [0xAA, 0xFF];
auto app = appender!string();
foreach(b; data)
formattedWrite(app, "%02X", b);
writeln(app.data); // AAFF
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment