我的字符串:
std::string With_esc = "asd\b";
我想将它转换为一个简单的字符串“as”(应用退格字符并忘记它)。有没有办法在 C++ 中做到这一点?它应该如下所示:
std::string With_esc = "asd\b";
std::string Without_esc = With_esc; //Here I should convert it
std::ofstream FWith_esc ("with");
std::ofstream FWithout_esc ("without");
FWithout_esc << Without_esc;
FWith_esc << With_esc;
重击:
~ cat -e with
asd^H
~ cat -e without
as
不幸的是,我不知道如何转换它,所以两个文件看起来完全一样。