Re: Is there a standard way to parse hex strings into numbers?

2014-03-24 Thread Gary Willoughby
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: 0xac036f90 Is there a standard way to parse this

Re: Is there a standard way to parse hex strings into numbers?

2014-03-24 Thread Brad Anderson
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: 0xac036f90 Is there a standard way to parse this into a ulong or do you just roll your own? To accepts a radix

Is there a standard way to parse hex strings into numbers?

2014-03-24 Thread Gary Willoughby
Is there a standard way to parse hex strings into numbers? I have the following returned as a string: 0xac036f90 Is there a standard way to parse this into a ulong or do you just roll your own?

Re: hex strings

2011-01-26 Thread Ellery Newcomer
On 01/26/2011 05:57 PM, spir wrote: On 01/26/2011 07:25 PM, Ellery Newcomer wrote: just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..." Super-nice for universal text. Anything you can't type in because of

Re: hex strings

2011-01-26 Thread Simen kjaeraas
spir wrote: Adds one char compared to D syntax, but allows partially hex-coded string: "blah #xx xxx# blah" I like having the ability to embed #'s in my strings, thank you. -- Simen

Re: hex strings

2011-01-26 Thread spir
On 01/26/2011 07:25 PM, Ellery Newcomer wrote: just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..." Super-nice for universal text. Anything you can't type in because of non-illimited keyboard size... Act

Re: hex strings

2011-01-26 Thread Jonathan M Davis
On Wednesday 26 January 2011 11:53:32 Ellery Newcomer wrote: > On 01/26/2011 01:35 PM, Jonathan M Davis wrote: > > On Wednesday, January 26, 2011 11:29:59 bearophile wrote: > >> Jonathan M Davis: > >>> That's legal? > >> > >> They are a part of

Re: hex strings

2011-01-26 Thread bearophile
Simen kjaeraas: > > cast(ubyte[]) x"..." > > Never used them, tbh. But shouldn't that be > > cast(ubyte[]) x"...".dup Maybe it's to avoid such mistakes that C++ has const_cast separated from other casts. Bye, bearophile

Re: hex strings

2011-01-26 Thread Ellery Newcomer
On 01/26/2011 02:16 PM, Simen kjaeraas wrote: Ellery Newcomer wrote: just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..." Never used them, tbh. But shouldn't that be cast(ubyte[]) x"...".dup ? yeah,

Re: hex strings

2011-01-26 Thread Simen kjaeraas
Ellery Newcomer wrote: just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..." Never used them, tbh. But shouldn't that be cast(ubyte[]) x"...".dup ? -- Simen

Re: hex strings

2011-01-26 Thread Ellery Newcomer
On 01/26/2011 01:35 PM, Jonathan M Davis wrote: On Wednesday, January 26, 2011 11:29:59 bearophile wrote: Jonathan M Davis: That's legal? They are a part of D language, search for "Hex Strings" here: http://www.digitalmars.com/d/2.0/lex.html It always seems like there'

Re: hex strings

2011-01-26 Thread Jonathan M Davis
On Wednesday, January 26, 2011 11:29:59 bearophile wrote: > Jonathan M Davis: > > That's legal? > > They are a part of D language, search for "Hex Strings" here: > http://www.digitalmars.com/d/2.0/lex.html It always seems like there's at least one more thing

Re: hex strings

2011-01-26 Thread bearophile
Jonathan M Davis: > That's legal? They are a part of D language, search for "Hex Strings" here: http://www.digitalmars.com/d/2.0/lex.html Bye, bearophile

Re: hex strings

2011-01-26 Thread Jonathan M Davis
On Wednesday, January 26, 2011 10:25:29 Ellery Newcomer wrote: > just out of curiosity, does anyone use these and actually mean them to > be strings? It seems like I'm invariably writing > > cast(ubyte[]) x"..." That's legal? I thought that x went in front of hex literals, not strings. I wouldn'

hex strings

2011-01-26 Thread Ellery Newcomer
just out of curiosity, does anyone use these and actually mean them to be strings? It seems like I'm invariably writing cast(ubyte[]) x"..."