Friday, February 17, 2006

ToString formating

this should be a basic C++ knowledge, but looks like it's easy to be forgotten. And even worse, hard to find it online since it's so basic.

if you have integer like 4,6,11. but you want to convert to string like "04","06","11", --- padding a "0" on the left if it's single digit.
then you should use this:

number.ToString("d2") // d means to decimal, where 2 means 2 digits format

1 comment:

Ymoon Yeemun Oon 温绮雯 said...

Hi i can only call you by code,

"ye zhang" means bad kamma.so, too bad i have to encounter with my many bad kammas (of couse some goods too.:) ) shouldn't you think you should live more high-tech age = kindda more metality than more animality? maybe you should try to be more human lah.