Formatting error for Lars

Lars Ivar Igesund larsivar at igesund.net
Fri Mar 21 02:39:55 PDT 2008


Ty Tower wrote:

> You responded to one of my annoyances posts re birds on the roof .
> You wanted a page number for that example
> 
> Page 131 and 132 deal with it in your book
> Neither :C  nor :G seem to work
> :G is the default and when I use {} its supposed to insert the 100
> I tried putting in the :G too
> 
> 
> module test;
> import tango.io.Stdout;
> import tango.text.locale.Locale;
>  
>  void main(){
>  Locale locale = new Locale;
>  Stdout("I have lost {:G} of my birds",20).newline;
>  Stdout.formatln("I have {:C} birds on the roof",100);
> }
> 
> 
> 
> [tytower at localhost tango]$  mystuff/test
> I have lost {} of my birds, 20
> I have {unknown format 'C'} birds on the roof

As Sobel said, and I said in the post you referenced; you are not following
the examples you claim not work. To use locale:

Stdout.layout = new Locale; // for the locale specified on that machine
Stdout.formatln("I have lost {:G} of my birds",20).newline;

Stdout by its own does not format, use format/formatln.
You need the layout set to Locale to be able to use the C specifier.

>From now on I expect you to test the examples as they are, and understand
them, before you try to modify them for your own purpose. If you find any
actual errors, please create a ticket.

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



More information about the Digitalmars-d mailing list