64,637
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
int main()
{
string str = "##,sd###,,,##jk <sd##,,, < <";
string delim = "#, <";
char buff[256];
strcpy(buff, str.c_str());
char* result = strtok(buff, delim.c_str());
for (;result;result = strtok(NULL, delim.c_str())) puts(result);
return 0;
}
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
char str[] = "##,sd###,,,##jk <sd##,,, < <";
char* result = strtok(str, "#, <");
for (;result;result = strtok(NULL, "#, <")) puts(result);
return 0;
}
string s = "##,sd###,,,##jk <sd##,,, < <";
char[] delim = { '#', ',', '<' };
string[] ss = s.Split(delim);
for (int i = 0; i < ss.Length; i++)
{
if (ss[i] != "")
{
Console.WriteLine(ss[i].ToString());
}
}