strtok CString 分割字符串
2012-11-06 11:48
323 查看
#include
#include
int main ()
{
char str[] ="- This, a sample string.";
char * pch;
printf ("Splitting string \"%s\" into tokens:\n",str);
pch = strtok (str," ,.-");
while (pch != NULL)
{
printf ("%s\n",pch);
pch = strtok (NULL, " ,.-");
}
return 0;
}
函数执行的结果:
Splitting string "- This, a sample string." into tokens:
This
a
sample
string
#include
int main ()
{
char str[] ="- This, a sample string.";
char * pch;
printf ("Splitting string \"%s\" into tokens:\n",str);
pch = strtok (str," ,.-");
while (pch != NULL)
{
printf ("%s\n",pch);
pch = strtok (NULL, " ,.-");
}
return 0;
}
函数执行的结果:
Splitting string "- This, a sample string." into tokens:
This
a
sample
string
相关文章推荐
- PHP字符串分割函数strtok--php1234--跟着明礼馨德修炼PHP
- c/c++ 字符串分割 (strtok)
- C语言sscanf()函数:从字符串中读取指定格式的数据&&C语言strtok()函数:字符串分割
- CString分割字符串实现
- VC++中按特定标志字符实现字符串到字符串数组的分割(CString -> Cstring[])
- strtok:字符串分割函数
- c++中怎么分割字符串之strtok 函数
- C/C++如何把一个特定分隔符分割的字符串划分为一个字符串数组,strtok(char *,char*)分割函数
- C语言strtok()函数:字符串分割
- CString 分割字符串
- 字符串分割函数StringTokenizer与strtok,strsep的比较
- c利用strtok来进行字符串分割
- C语言:使用strtok()函数分割字符串
- C语言 strtok 字符串分割
- C语言strtok()函数:字符串分割
- C语言strtok()函数:字符串分割
- splitString CString 类型的字符串分割
- strtok 分割字符串
- strtok、strtok_s、strtok_r 字符串分割函数
- 字符串中如何以空格或回车换行分割一个CString字符串为多个字符串?