[Solved] Custom string formatting: ToString(“00”)


The “0” custom format specifier serves as a zero-placeholder symbol. If the value that is being formatted has a digit in the position where the zero appears in the format string, that digit is copied to the result string; otherwise, a zero appears in the result string. The position of the leftmost zero before the decimal point and the rightmost zero after the decimal point determines the range of digits that are always present in the result string.

The “00” specifier causes the value to be rounded to the nearest digit preceding the decimal, where rounding away from zero is always used. For example, formatting 34.5 with “00” would result in the value 35.

The “0” Custom Specifier
link text

solved Custom string formatting: ToString(“00”)