String.Format() formatting specifiers

  • Thread starter Thread starter Chris Morse
  • Start date Start date
C

Chris Morse

Hi,

I've been trying to figure out where in the documentation it describes
all the String.Format() formatting specifiers. So far, I've been
guessing and picking up specifiers in sample code.. but I've never
seen a detailed descriptions of all that's possible.

For example,

Dim n As Integer = 65536

String.Format("{0:D8}", n)

displays "00065536"

String.Format("{0:X4}", n)

displays "FFFF"

String.Format("{0:D4}-{1:D2}-{2:D2}",2003, 9, 2)

displays "2003-09-02"

String.Format("{0,-12:G}{1,-8:G)", "TEST1","TEST2")

displays "TEST1 TEST2 "

Can someone show me where this is all documented? The MSDN help for
the String.Format() function doesn't cover all this, and I've never
hit upon the right documentaiton in any of the string formatting
sections.

Thanks,
// CHRIS
 
Chris,
Can someone show me where this is all documented?

Look for the Formatting Types topic in the documentation. You should
find it by entering "formatting types" on the Index tab.



Mattias
 
Back
Top