|
"% m.nf", represented by at least m digits, the number of decimal places occupies n digits (fixed n digits, less than 0),
% 5.2f, limited to only 2 digits after the decimal point, and at least 3 digits before the decimal point, if it exceeds 3, normal digits are displayed
float f = 1234.456;
CString str;
str.Format ("% 5.2f", f);
Result: 1234.45
str.Format ("% 3.2f", f);
Result: 1234.45
str.Format ("% 5.1f", f);
Results: 1234.4 |
|