目录
一、去除空格
1、方法一 ,适用于纯英文
缺点 实测字符串有中文时 崩溃
#include <functional> // std::not1
#include <algorithm>
#include <cctype>
// trim from start
static inline std::string <rim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
return s;
}
// trim from end
static inline std::string &rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.en