How to convert hex string to string or ubytes? Thanks.

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Feb 5 05:46:35 UTC 2018


On Mon, Feb 05, 2018 at 05:48:00AM +0000, FrankLike via Digitalmars-d-learn wrote:
> Now,I can get the string from hex string in compile time,but how to
> get it in run time?
> 
> How to get it in run time?
> 
> Thanks.

	import std.conv;
	string hex = "900D1DEA";
	uint value = hex.to!uint(16);
	assert(value == 0x900D1DEA);


T

-- 
Be in denial for long enough, and one day you'll deny yourself of things you wish you hadn't.


More information about the Digitalmars-d-learn mailing list