[STL ] strtok c++版
總覺得很多人想要在c++裡面用類似strtok功能的function,所以就心血來潮寫了一個
STL版的strtok
http://nopaste.csie.org/eea98
範例用法:
#include <iostream>
#include "strtok.hpp"
using namespace std;
int main() {
string a = ",-1- ,2";
string b = ", -";
for (strtok_iterator i(a, b), end; i != end; ++i) {
cout << *i << endl;
}
}
// output:
// 1
// 2
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.123.225.77
※ 編輯: ibmibmibm 來自: 140.123.225.77 (06/06 02:01)
→
06/06 02:16, , 1F
06/06 02:16, 1F
→
06/06 02:17, , 2F
06/06 02:17, 2F
→
06/06 02:17, , 3F
06/06 02:17, 3F
推
06/06 10:44, , 4F
06/06 10:44, 4F