Numerical formatting using String.Format
-
08-06-2019 - |
Question
Are there any codes that allow for numerical formatting of data when using string.format?
Solution
Loads, stick string.Format
into Google :-)
A quite good tutorial is at iduno
OTHER TIPS
Yes, you could format it this way:
string.Format("Format number to: {0 : #.00}", number);
string.Format("Format date to: {0 : MM/dd/yyyy}", date);
There are a number. This MS site is probably the best place to look
Here is another very good reference that compliments what Keith mentioned.
As Keith said above. The most common one I use is currency:
String.Format("{0:c}", 12000);
Which would output £12,000.00
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow