c++去除string首尾空格、string转int、int转string、char换string
去除string首尾空格,利用string中函数s.erase();s.find_first_not_of()s.find_last_not_of()#include <bits/stdc++.h>using namespace std;void trim(string &s){ if(s.empty()) return; s.erase(0,s.find_first_not_of(' '));//去除首部全部空格 s.erase(
原创
2021-06-21 16:30:52 ·
344 阅读 ·
0 评论