#include <iostream>
#include <cstring>
#include <map>
using namespace std;
int main()
{
char sentence[] = "this is a sectence with 7 tokens";
char *tokerPtr = strtok(sentence," ");
while(tokerPtr != NULL)
{
cout<<tokerPtr <<endl;
tokerPtr = strtok(NULL," ");
}
cout<<"sentence=="<<sentence<<endl;
system("pause");
return 0;
}
字符串分割函数strtok例子
最新推荐文章于 2023-09-25 22:24:04 发布