保留数字字符串小数点后有效数字,以CString为例 思路:从字符串最后一位向前查找,如果有0则去除 代码如下 CString FormatNum(CString str) { // 查找小数点位置 int dot_pos = str.Find(_T('.')); if (dot_pos !=