#include
using namespace std;
int main()
{
auto isSpace = [](const unsigned char c)
{
return std::isspace(c);
};
string msg("hh hh hh pp");
msg.erase(remove_if(msg.begin(), msg.end(),isSpace), msg.end());
cout << "msg--" << msg << endl;}
C++11 删除字符串中的空格/回车/制表符
原创fgxtzwzjlw ©著作权
©著作权归作者所有:来自51CTO博客作者fgxtzwzjlw的原创作品,请联系作者获取转载授权,否则将追究法律责任
下一篇:NOR和NAND区别
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
python基础-条件语句、while、字符串格式化、运算符、字符串编码
学习Python基础的笔记,看视频学Python。
字符串 Python 代码块 python基础 -
java中字符串拼接的多种方式
java中字符串拼接的多种方式
java 字符串拼接