"D" annoyances

Lars Ivar Igesund larsivar at igesund.net
Sat Mar 15 15:47:50 PDT 2008


Ty Tower wrote:

> Another
> The output does not recognise "C" nor "alignment" ?

For C, see below. "alignment" is not a specifier in itself in any way, it is
the number seen behind a comma in some of the examples; so what do you mean
with it not being recognized? 

>  Your lookers should not have to go delving to find out why, it needs to
>  just work.

We appreciate tickets posted at
http://www.dsource.org/projects/tango/newticket

>  
> [tytower at linuxbox text]$ formatspec
> I have {unknown format 'C'} in cash.
> Avogadro's number is 6.02e+23.
> Avogadro's number (with alignment) is 6.02e+23.
> 
> 
> This is the example program which also appears in the tango book

You need to point me to where this can be found in the book, in which case
it will be listed in the errata.

> /**
> 
>   Example showing how to use format specifier components in a format
>   string's argument.
> 
>   Put into public domain by Lars Ivar Igesund
> 
> */
> 
> import tango.io.Stdout;
> 
> void main(){
>     double avogadros = 6.0221415e23;
>     Stdout.formatln("I have {0:C} in cash.", 100);
>     Stdout.formatln("Avogadro's number is {0:E}.", avogadros);
>     Stdout.formatln("Avogadro's number (with alignment) is {0,4:E}.",
>     avogadros);
> }

Thanks, this example is indeed in error. Currently C is only available as a
specifier if you have a Locale enabled (as you can read in the book). The E
specifier does appear to not work properly under Locale though.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango



More information about the Digitalmars-d mailing list