On Monday, 19 May 2014 at 12:28:14 UTC, anonymous wrote:
On Monday, 19 May 2014 at 11:36:43 UTC, Darren wrote:
Is there an idiomatic/simple way to do that?
import std.conv: parse;
import std.array: array;
import std.range: chunks;
import std.algorithm: map;
ubyte[] bytes = hexnum /* "16D8..." */
.chunks(2) /* "16", "D8", ... */
.map!(twoDigits => twoDigits.parse!ubyte(16)) /* 0x16,
0xD8,
... */
.array();
Nice, thanks! I've added a slightly edited version as the answer
to this question on stackoverflow:
http://stackoverflow.com/a/23741556/47481