![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c
a690141760
这个作者很懒,什么都没留下…
展开
-
strstr查找字符串
#include<stdio.h>#include<string.h>//内部自己实现算法const char* strStr(const char* str1, const char* str2) { while (*str1) { const char* p1 = str1; const char* p2 = str2; while (*p2) { if (*p2 && *p2 == *p1) { p2++; }.原创 2021-05-02 15:53:20 · 191 阅读 · 0 评论 -
Strpbrk函数
C 库函数char *strpbrk(const char *str1, const char *str2)检索字符串str1中第一个匹配字符串str2中字符的字符,不包含空结束字符。也就是说,依次检验字符串 str1 中的字符,当被检验字符在字符串 str2 中也包含时,则停止检验,并返回该字符位置。int main() { const char* str = "This is a sample string"; const char key[] = "aeiou"; const...原创 2021-05-02 14:57:34 · 263 阅读 · 0 评论 -
strrchr函数
strrchr函数作用:字符串中搜索最后一次出现字符#include<stdio.h>#include<string.h>int main() { char str[] = "This is a sample string"; char* pch; pch = strrchr(str,'s'); printf("最后一个字符位置:%d\n",pch-str+1); return 0;}自己实现内部原理#include<stdio.h&g.原创 2021-05-01 22:41:33 · 410 阅读 · 0 评论