Click to See Complete Forum and Search --> : [RESOLVED] 17000 -> 17.000 and sharp margin?


LoopString
March 27th, 2010, 01:00 PM
Hello,

I have three values, for instance 17000, 12345 and 4655. Is there any special way to present them like below? Please note the dots(.) and the sharp left margin. (NET3.5 / VS 2008 )


number1 17.000
number2: 12.345
result: 4.655

JonnyPoet
March 27th, 2010, 04:45 PM
number1 17.000
number2: 12.345
result: 4.655
Simple format your string. How is the output doen? Console application?

LoopString
March 27th, 2010, 04:56 PM
Thanks for the answer, yes it is console application, playing around in visual studio.

JonnyPoet
March 27th, 2010, 05:46 PM
Thanks for the answer, yes it is console application, playing around in visual studio.
int a = 17000;
int b = 12345;
int c = a - b;
Console.WriteLine("number1 {0:0,0}",a);
Console.WriteLine("number2 {0:0,0}", b);
Console.WriteLine("result {0:0,0}", c);

LoopString
March 27th, 2010, 06:14 PM
Thank you JonnyPoet, your code is like poetry. :)