I want to format a price using string.Format. I am able to get the correct currency symbol but can't figure out the regex to always have 2 decimal places regardless if they are 0s. Here is my code:
CultureInfo us = CultureInfo.GetCultureInfo("en-US");
price.text = string.Format(us, "{0:C}",inventory.priceTotal);
Add 2
to C
so C2
string.Format(us, "{0:C2}",inventory.priceTotal);
See also Standard Numeric Format Strings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With