#include "pch.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
char string[] =
"代理IP 1092230704 HTTP SOCKS5 有需要的可以联系我。。。。。";//需要拆分的对象
char seps[] = "\ .,\t\n";//拆分的分隔符
char *token = NULL;
char *next_token = NULL;//拆分后字符存放位置
int main(void)
{
printf("Tokens:\n");
// Establish string and get the first token:
token = strtok_s(string, seps, &next_token);
// While there are tokens in "string1" or "string2"
while (token != NULL)
{
// Get next token:
if (token != NULL)
{
printf(" %s||", token);
token = strtok_s(NULL, seps, &next_token);
}
}
//printf("the rest token1:\n");
printf("结束");
}
c++拆分字符串
最新推荐文章于 2024-05-12 09:00:00 发布