Number Formatting for Zero Values

From Birnam Designs Wiki

Jump to: navigation, search
String.Format("{0:#,###}", intNumber)

This works for most numbers, but when intNumber = 0 it returns an empty string.

You can specify what format to do for zero values:

String.Format("{0:#,###;;zero}", intNumber)

The ; delimiters specify: positive;negative;zero

Share This!
This page was last modified on 11 February 2010, at 19:43. This page has been accessed 393 times.