www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Formatting error for Lars

reply Ty Tower <tytower hotmail.com.au> writes:
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 localhost tango]$  mystuff/test
I have lost {} of my birds, 20
I have {unknown format 'C'} birds on the roof
Mar 20 2008
next sibling parent Sobel <sobel web.com> writes:
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;
Instantiating a Locale by itself isn't enough. You need to tell Stdout that you want localized output. Stdout.layout = new Locale;
  Stdout("I have lost {:G} of my birds",20).newline;
I don't think the opCall syntax - Stdout() - supports formatting.
  Stdout.formatln("I have {:C} birds on the roof",100);
Now it should work - but it will print something like: I have $100 birds on the roof because C is the format specifier for currency. G is the default, and works regardless of the locale.
 }
 
 
 
 [tytower localhost tango]$  mystuff/test
 I have lost {} of my birds, 20
 I have {unknown format 'C'} birds on the roof
 
Mar 21 2008
prev sibling parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
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 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
Mar 21 2008
parent reply Ty Tower <tytower hotmail.com.au> writes:
Lars Ivar Igesund wrote:

 From now on I expect you
Up yours .I could not give a shit what you expect .Where do you get off you arrogant prick.I will continue to change examples as I wish and how I learn is no business of yours. You should get off your high horse and answer in a reasonable fashion or do not bother to answer at all in my opinion and I don't tell people what to do at all if I can help it. That said you are of course right but in the example queried by someone else you gave a pretty cryptic , curt reply which did not explain anything and it was posted on the .learn forum too. Well see how long this post stays up until that Phillips bastard deletes it again .
Mar 21 2008
next sibling parent Lars Ivar Igesund <larsivar igesund.net> writes:
Ty Tower wrote:

 Lars Ivar Igesund wrote:
 
 From now on I expect you
Up yours .I could not give a shit what you expect .Where do you get off you arrogant prick.I will continue to change examples as I wish and how I learn is no business of yours. You should get off your high horse and answer in a reasonable fashion or do not bother to answer at all in my opinion and I don't tell people what to do at all if I can help it.
See above; you just did. As to my high horse, I'm afraid I would get hurt if I tried to get off it - it is quite high. Not even my arrogancy suit would protect me. -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Mar 21 2008
prev sibling parent reply Cosmonaut <yao gmail.com> writes:
Ty Tower escribió:
 Lars Ivar Igesund wrote:
 
 From now on I expect you
Up yours .I could not give a shit what you expect .Where do you get off you arrogant prick.I will continue to change examples as I wish and how I learn is no business of yours. You should get off your high horse and answer in a reasonable fashion or do not bother to answer at all in my opinion and I don't tell people what to do at all if I can help it. That said you are of course right but in the example queried by someone else you gave a pretty cryptic , curt reply which did not explain anything and it was posted on the .learn forum too. Well see how long this post stays up until that Phillips bastard deletes it again .
Idiot.
Mar 21 2008
parent reply Ty Tower <tytower hotmail.com.au> writes:
Cosmonaut wrote:


 Idiot.
When someone makes a one word post it usually is not going to help at all However that presumes the writer has half a brain and can understand and write English. I see from your posts you don't read the post , don't understand the post and I presume therefore you don't speak English So piss off you wog bastard
Mar 21 2008
next sibling parent Cosmonaut <yao gmail.com> writes:
Ty Tower escribió:
 Cosmonaut wrote:
 
 
 Idiot.
When someone makes a one word post it usually is not going to help at all However that presumes the writer has half a brain and can understand and write English. I see from your posts you don't read the post , don't understand the post and I presume therefore you don't speak English So piss off you wog bastard
Idiot... I.D.I.O.T.
Mar 21 2008
prev sibling parent "David Wilson" <dw botanicus.net> writes:
On Sat, Mar 22, 2008 at 12:37 AM, Ty Tower <tytower hotmail.com.au> wrote:
 Cosmonaut wrote:


  > Idiot.

  When someone makes a one word post it usually is not going to help at
  all  However that presumes the writer has half a brain and can
  understand and write English.

  I see from your posts you don't read the post , don't understand the
  post and I presume therefore you don't speak English
  So piss off you wog bastard
I assume that as a supposedly intelligent resident of Queensland, you would be familiar with your state's racial vilifaction laws. If not, you may learn more here: http://www.legislation.qld.gov.au/LEGISLTN/CURRENT/A/AntiDiscrimA91.pdf Specifically: Chapter 5A Serious racial and religious vilification 131A Offence of serious racial, religious, sexuality or gender identity vilification (1) A person must not, by a public act, knowingly or recklessly incite hatred towards, serious contempt for, or severe ridicule of, a person or group of persons on the ground of the race, religion, sexuality or gender identity of the person or members of the group in a way that includes— (a) threatening physical harm towards, or towards any property of, the person or group of persons; or (b) inciting others to threaten physical harm towards, or towards any property of, the person or group of persons. Maximum penalty— (a) for an individual—70 penalty units or 6 months imprisonment; (b) for a corporation—350 penalty units. You have broken this law twice in the past month. I would like to remind you that there is a potential price to pay for being so unevolvedly uncivil to fellow Internet users, one clearly highlighted above. I doubt it would take more than a few long distance phone calls to your local police to come and remind you of the cost of bigotry. (Note that person won't be me, but I have hopefully just lowered the bar for someone else to do it). David.
Mar 21 2008