strsep() 函数
来源:互联网 发布:c语言自定义标识符 编辑:程序博客网 时间:2024/06/05 06:40
函数原型:
char *strsep(char **stringP,const char *delim);
参数说明
stringP: 要被分割的字符串地址,函数执行后该元素被更改,总是只想要被分割的字符串;
delim: 分割符;
返回值:
函数返回分割后的第一个字符串。函数执行的过程,是在 *stringp 中查找分割符,并将其替换为“\0”,返回分割出的第一个字符串指针(NULL 表示到达字符串尾),并更新 *stringp 指向下一个字符串。
头文件:
#include<string.h>
范例:
#include<stdio.h>
#include<string.h>
int main()
{
char * const delim="/;";
char str[]="some/splite;string";
char *token,*cur=str;
while(token=strsep(&cur,delim))
{
printf("%s %s %s\n",token,cur,str);
}
return 0;
}
运行结果:
some splite;string some
splite string some
string (null) some
阅读全文
0 0
- strsep 函数
- strsep 函数
- strsep函数
- strsep() 函数
- strsep函数用法
- strsep函数用法
- 字符串分割函数strsep
- 字符串分割 strsep 函数
- Linux中 strsep 函数 详解
- strsep 函数 c 语言 实现
- strtok和strsep函数详解
- strtok和strsep函数详解
- strtok 与 strsep 函数说明
- strtok和strsep函数详解
- strtok和strsep函数详解
- strtok 与 strsep 函数说明
- strtok和strsep函数详解
- strtok和strsep函数详解
- 线程的创建
- 阅读A Discriminative Feature Learning Approach for Deep Face Recognition
- BZOJ 1088: [SCOI2005]扫雷Mine 题解
- 考研函数总结心得
- Event事件对象之媒体事件
- strsep() 函数
- 【STM32】 keil软件介绍--工程目标选项配置(上)
- 远程连接工具的使用之SSH Secure
- 收拾行装,再出发
- 注解与依赖注入
- 欧拉函数模板 筛法 直接求
- 不同系统之间的文件传输
- C语言——实例010 打印楼梯,同时在楼梯上方打印两个笑脸。
- BZOJ 2002: [Hnoi2010]Bounce 弹飞绵羊 LCT