strpbrk函数
来源:互联网 发布:python列表转字典 编辑:程序博客网 时间:2024/06/01 08:28
strpbrk函数
【1】函数功能:strpbrk是在源字符串(s1)中找出最先含有搜索字符串(s2)中任一字符的位置并返回,若找不到则返回空指针。
【2】头文件
#include <string.h>
【3】原型
extern char *strpbrk(const char *s1, const char *s2);char * strpbrk(const char * cs,const char * ct){ const char *sc1,*sc2; for( sc1 = cs; *sc1 != '\0'; ++sc1) { for( sc2 = ct; *sc2 != '\0'; ++sc2) { if (*sc1 == *sc2) { return (char *) sc1; } } } return NULL;}
【4】例子
#include<stdio.h>#include<stdlib.h>#include<string.h>int main(){ char *s1="Xiyou Linux Group"; char *s2="Linux"; char *p; /*Example 1*/ p=strpbrk(s1,s2); if(p) { printf("%s\n",p); } else { printf("Not Found!\n"); } /*Example 2*/ p=strpbrk(s1, "hhhhhhh"); if(p) { printf("%s",p); } else { printf("Not Found!\n"); } return 0;}
阅读全文
0 0
- strpbrk函数
- strpbrk() 函数
- strpbrk() 函数
- strpbrk() 函数
- strpbrk函数
- strpbrk函数
- strpbrk函数
- strpbrk函数
- strpbrk函数
- strpbrk函数
- strpbrk函数
- strpbrk 函数
- strpbrk函数
- strpbrk()函数
- strpbrk函数
- strpbrk函数
- 字符串函数strpbrk
- 字符串函数strpbrk
- nmcli双网卡绑定
- AsyncTask详解
- ajaxFileUpload上传图片
- 20170728_双端队列deque的常用函数
- springmvc单例的线程安全
- strpbrk函数
- memcached 和 redis 的区别与选择
- iMobile与Online在线场景数据的交互
- gSOAP+onvif初探(三):PTZ控球
- 时间、日期、Toasts和进度条Dialog
- dubbo框架学习(二)-启动dubbo源码中的dubbo demo 项目
- ansible02 主机目录
- WCF和ASMX WebService的区别是什么
- 二叉树学习:从零基础到代码实现