我在说的CString类型是microsoft's。如何摆脱C++中CString中的字符串
我试过两种方法;使用删除()和替换()在MSDN网站上找到的功能,和Visual C
方法1)++说Error:argument of type "const char*" is incompatible with argument of type "wchar_t"
特别是我的代码是:
#include <cstring>
CString sTmp= sBody.Mid(nOffset);
CString sFooter= L"https://" + sTmp.Mid(0, nEnd);
sFooter.Remove("amp;");
而且我不希望一次删除一个字符,因为它会删除其他'a'。
出于某种原因,当我转换sFooter到的std :: string,随机的“放大器;” S似乎不应该出现在字符串中...
我转换sFooter到一个std: :字符串是这样的:
CT2CA p (sFooter);
string str (p);
方法2)转换CString的到的std :: string,然后使用擦除()和remove()摆脱的 “放大器;” S
#include <string>
#include <algorithm>
sFooter2.erase(std::remove(sFooter2.begin(), sFooter2.end(), "amp;"), sFooter2.end());
但Visual Studio的输出显示了这个:http://pastebin.com/s6tXQ48N
它的工作原理的“wchar_t的”'的说法不兼容!谢谢你,先生 – minusatwelfth 2012-08-01 06:42:52