I would like to know the easiest way to format a string as accounting style. I know how to format as currency using {0:c} but there are some differences in accounting style, for example, all the dollar signs will line up as well as all the decimal points, and negatives are expressed in parenthesis rather than with a ‘-‘ minus sign. You can find a good example of the way i would like it in excel if you format the cells as ‘accounting’ with 2 decimal places.
Share
Ignoring your alignment requirements, you could use
to bracket negative numbers.
To align your numbers, you’d have to format without the currency symbol, and pad the formatted numbers yourself with spaces, using a fixed width font would make this job easier for you.
EDIT:
It seems String.Format is your friend:
where 15 is the total width of the output, and you need to append this text to your currency symbol. (Again, this aligns in fixed width only)