Absolute beginner

Justin Whear justin at economicmodeling.com
Fri Jan 13 16:20:35 PST 2012


On Fri, 13 Jan 2012 23:05:19 +0100, Matej Nanut wrote:

> While we're at it: what's the best way to parse in a formatted manner?
> For example, if I want to get 5 hexadecimal digits converted into an
> uint? And I want to simultaneously advance the string?
> 
> "sscanf" seems fiddly and unsafe.
> 

Check out readf: http://d-programming-language.org/phobos/
std_stream.html#readf

You'll need to wrap the string in a Stream interface (MemoryStream?), but 
since you're looking for advance-on-read, you want stream semantics 
anyhow.

Justin


More information about the Digitalmars-d-learn mailing list