views:

527

answers:

1

Is there a format string (?) I can pass to the VB6 Format function that will perform digit grouping? I want to replace the question mark in this statement...

Debug.Print Format(123456789, "?")

...with a string that will generate the following output:

123,456,789

The predefined format string "Standard" comes close, but it tacks a decimal point and two 0's on the end:

? Format(123456789, "Standard")
123,456,789.00
+3  A: 

As I was typing the question I took another glance at the documentation and spotted the answer, but I went ahead and posted it anyway. Here it is:

Debug.Print Format(123456789, "#,##0")
raven
Ask a question, and then answer it yourself? Is this a sneaky way to get more rep points? Must try it myself :)
MarkJ
Joacim is inccorrect. The comma in the format string is replaced with the appropriate digit grouping symbol. I have just set my PC to Spanish regional settings and ?format$(123456789, "#,##0") gives the following: 123.456.789
MarkJ
@MarkJ: Cool. Thanks for the verification. I should have done that myself (I just did).
raven