Thread overview | |||||
---|---|---|---|---|---|
|
March 24, 2014 Is there a standard way to parse hex strings into numbers? | ||||
---|---|---|---|---|
| ||||
Is there a standard way to parse hex strings into numbers? I have the following returned as a string: 0xffffffffac036f90 Is there a standard way to parse this into a ulong or do you just roll your own? |
March 24, 2014 Re: Is there a standard way to parse hex strings into numbers? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Gary Willoughby | On Monday, 24 March 2014 at 16:30:37 UTC, Gary Willoughby wrote: > Is there a standard way to parse hex strings into numbers? > > I have the following returned as a string: > > 0xffffffffac036f90 > > Is there a standard way to parse this into a ulong or do you just roll your own? To accepts a radix parameter. You need to strip off the 0x though. "ffffffffac036f90".to!ulong(16) -> 18446744072300490640 |
March 24, 2014 Re: Is there a standard way to parse hex strings into numbers? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brad Anderson | On Monday, 24 March 2014 at 16:35:42 UTC, Brad Anderson wrote:
> On Monday, 24 March 2014 at 16:30:37 UTC, Gary Willoughby wrote:
>> Is there a standard way to parse hex strings into numbers?
>>
>> I have the following returned as a string:
>>
>> 0xffffffffac036f90
>>
>> Is there a standard way to parse this into a ulong or do you just roll your own?
>
> To accepts a radix parameter. You need to strip off the 0x though.
>
> "ffffffffac036f90".to!ulong(16) -> 18446744072300490640
Awesome ta.
|
Copyright © 1999-2021 by the D Language Foundation