1 //spilt函数的实现 2 //假设以空格切分:char c = ' '; 3 class Solution 4 { 5 vector<string> res; 6 void spilt(string s,char c,vector<string> &res) 7 { 8 istringstream iss(s); 9 string temp; 10 while(getline(iss,temp,c)) 11 { 12 //如果temp不为空,才可以添加进去 13 if(!temp.empty()) res.push_back(temp); 14 } 15 } 16 };
spilt函数的实现
猜你喜欢
转载自www.cnblogs.com/yuhong1103/p/12526596.html
今日推荐
周排行