Q:

Right align currency in string format

I'm trying to align some currency to the right:
double number1 = 150.45;
double number2 = 1400.95;

//Output  kr. 150,45
Console.WriteLine("{0:c2}", number1);

//Output  kr. 1.400,95
Console.WriteLine("{0:c2}", number2);

But I want my output to look like this.
//Output kr.   150.45

//Output kr. 1.400,95

Where the number is aligned to the right?

A:

it's rather hard for the system to say how many places your numbers have. So you have to decide this yourself. If you have decided you can use something like String.PadLeft
For example
Console.WriteLine("kr. {0}", number1.ToString("#,##0.00").PadLeft(10,' '));

A:

 string sym = CultureInfo.CurrentCulture.NumberFormat.CurrencySymbol;
 Console.WriteLine("{0}{1,10:#,##0.00}",sym, number1);
 Console.WriteLine("{0}{1,10:#,##0.00}",sym, number2);

ideone output 

