(standard c libraries translation )strpbrk
来源:互联网 发布:2kol球员数据更新2017 编辑:程序博客网 时间:2024/04/29 05:25
strpbrk - search a string for any of a set of bytes
所需头文件
#include <string.h>
char *strpbrk(const char *s, const char *accept);
The strpbrk() function locates the first occurrence in the string s of any of the bytes in the string accept.
The strpbrk() function returns a pointer to the byte in s that matches one of the bytes in accept, or NULL if no such byte is found.
strpbrk函数定位字符串s中第一次出现字符串accept中的字节的位置
运行结果如下:
所需头文件
#include <string.h>
char *strpbrk(const char *s, const char *accept);
The strpbrk() function locates the first occurrence in the string s of any of the bytes in the string accept.
The strpbrk() function returns a pointer to the byte in s that matches one of the bytes in accept, or NULL if no such byte is found.
strpbrk函数定位字符串s中第一次出现字符串accept中的字节的位置
strpbrk函数返回指向s中第一次出现accept中字节的问题,如果没有这个字节则返回NULL
testcase如下:
#include <stdio.h>#include <string.h>int main(void){const char *dest = "abc12cba";const char *accept1 = "xyz12";const char *accept2 = "xyz";char *tmp = NULL;tmp = strpbrk(dest, accept1);printf("tmp = %s\n", tmp);tmp = strpbrk(dest, accept2);if (tmp == NULL) {printf("tmp is null\n");}return 0;}
运行结果如下:
cheny.le@cheny-ThinkPad-T420:~/cheny/testCode$ ./a.out
tmp = 12cba
tmp is null
这个函数的主要功能就是在一个字符串中查找指定的字符集
0 0
- (standard c libraries translation )strpbrk
- (standard c libraries translation)isalpha家族
- (standard c libraries translation )atoi家族
- (standard c libraries translation)alloca
- (standard c libraries translation )sbrk家族
- (standard c libraries translation )malloc家族
- (standard c libraries translation )getpagesize
- ( standard c libraries translation )time家族
- (standard c libraries translation )bcmp家族
- (standard c libraries translation )index
- ( standard c libraries translation )memcpy家族
- (standard c libraries translation )strcmp家族
- (standard c libraries translation )strcat
- (standard c libraries translation )strchr
- (standard c libraries translation )strspn
- (standard c libraries translation )strcpy
- (standard c libraries translation )strdup
- (standard c libraries translation )strlen
- SecureCRT上传、下载文件(使用sz与rz命令)
- linux TCP数据包重传过程----小结
- 百度在 2013 年是衰落的吗?是有怎样的依据?
- Android事件处理之多点触摸与手势识别
- BeautyEye主题使用中去除半透明效果
- (standard c libraries translation )strpbrk
- maven setting.xml
- IOS高级开发~Runtime(一)
- Fragment实现底部选项卡切换效果
- Ajax 异步请求的基本步骤
- poll函数
- cocos2dx使用TiledMap创建斜45度地图场景
- 【数据结构】单向链表
- SET命令用法详解