如何只保留string中的数字

来源:互联网 发布:手机咋发淘宝客服图片 编辑:程序博客网 时间:2024/05/10 17:32

如何只保留其中的数字
string a = "a3b4c!&d";
string::iterator it = remove_if(a.begin(), a.end(), not1(ptr_fun(isdigit)));
a.erase(it, a.end()); // 34

原创粉丝点击