How do you get a hexstring from a base10 string -or- from a number?

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 3 16:10:23 PST 2016


On Wed, Feb 03, 2016 at 11:45:15PM +0000, Enjoys Math via Digitalmars-d-learn wrote:
> On Wednesday, 3 February 2016 at 23:43:45 UTC, Enjoys Math wrote:
> >I am making a method called:
> >
> >@property string debugIDString() {
> >in {
> >  assert(super.toHash() == this.toHash());
> >} body {
> >
> >}
> 
> body { // is currently:
>   return to!string(this.toHash());
> }
> 
> and is returning a base10 string, so how would I return a hex string so I
> can compare numbers displayed to the debugger addresses in visual D?

	@property string debugIDString() {
		import std.format;
		return format("%x", this.toHash());
	}


T

-- 
Study gravitation, it's a field with a lot of potential.


More information about the Digitalmars-d-learn mailing list