要把一个浮点数转换成字符串,宽度和小数位在运行时刻才能得到,可用如下方法: CString str;str.Format( " %0*.*f,%0*.*f " , 6 , 3 , 2.1 , 8 , 4 , 5.3 ); 结果str为"02.100,005.3000"