我得到一个文件作为输入,我像这样读取第一行(引号标记开始和结束,但不在文件中):
" 1, 2.0, 3.0, 4.0 "
当我像这样使用删除命令时:
astring = line;
cout << endl << "Before trim: " << line << endl;
remove(astring.begin(), astring.end(), ' ');
cout << endl << "After trim: " << astring << endl;
我得到的输出为:
1,2.0,3.0,4.02.0, 3.0, 4.0
我只需要输出1,2.0,3.0,4.0
。这里有什么问题?