Question

Are there any codes that allow for numerical formatting of data when using string.format?

Was it helpful?

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);

Here is another very good reference that compliments what Keith mentioned.

http://www.scribd.com/doc/2547864/msnetformattingstrings

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
scroll top