FormatSpec struct

James Miller james at aatch.net
Fri Apr 13 02:10:42 PDT 2012


* James Miller <james at aatch.net> [2012-04-13 19:16:48 +1200]:
> * Paul D. Anderson <paul.d.removethis.anderson at comcast.andthis.net> [2012-04-13 07:50:31 +0200]:
> > I'm trying to add formatted output to my decimal arithmetic module.
> > Decimals should format like floating point, using 'E', 'F' and 'G',
> > etc.
> > 
> > I would expect a format string like "%9.6e" to parse as width = 9,
> > precision = 6, using exponential notation.
> > 
> 
> Hey Paul, so some investigation has led me to believe that FormatSpec is
> really just for internal usage. The documentation is a bit misleading
> (to the point of being possibly completely false).
> 
> FormatSpec, AFAICT, is essentially just a parser for the standard format
> specifier, but its not very clear as to proper usage. I'm going to try
> to improve it and submit a pull request, until then looking at the
> source code for std.format should give you some idea of how to best use
> it.
> 
> --
> James Miller
> 

So I made the pull request, the documentation you need to read is here:

https://github.com/Aatch/phobos/commit/cda3c079ee32d98a017f88949c10097840baa075

Hopefully it helps.

--
James Miller


More information about the Digitalmars-d-learn mailing list