CString str ="53 2f 2 3 4 ffffff4f 0 45"; CString strTmp1 = ""; CString strTmp2 = ""; str.Remove('f'); for (int i = 0; i <= 9; ++i) { strTmp1.Format(" %d ", i); strTmp2.Format(" %.2d ", i); while (str.Find((LPCTSTR)strTmp1) != -1) { str.Replace((LPCTSTR)strTmp1, (LPCTSTR)strTmp2); } } cout << (LPCTSTR)str << endl; // 运行结果 53 02 02 03 04 04 00 45 Press any key to continue
字符串补齐
最新推荐文章于 2022-07-06 09:02:45 发布