Next code should work:
output_text = String.Format("Total pay on day {0} is {1,10:c}", day, total_running_pay)
Frage
I can find a smattering of examples, but not a detailed explanation for how text formatting works. (Tons of information/examples for Python, for example).
I have
output_text = "Total pay on day " + day + " is " + total_running_pay.ToString("c");
where day and total running pay are integers.
This gives a list like:
Total pay on day 1 is $1
Total pay on day 2 is $3
Total pay on day 3 is $7
Total pay on day 4 is $15
etc.
I would like the dollar amounts to be right aligned.
Any suggestions?
Lösung
Next code should work:
output_text = String.Format("Total pay on day {0} is {1,10:c}", day, total_running_pay)