通过函数的定义来区分:

1.strstr: 返回子串出现的第一次位置

  1. char *strstr(const char *haystack, const char *needle)

可见,strstr函数搜索的是一个const char*型的数据,即字符串常量

2.strchr: 返回字符出现的第一次位置

  1. char *strchr(const char *str, int c)

而strchr搜索的是一个int型的数据,即字符

3.strrchr: 返回字符出现的倒数第一次位置

  1. char *strrchr(const char *str, int c)

另外,strrchr返回字符c在字符串str中最后出现的位置

4.strrstr:返回子串出现的倒数第一次位置

  char *strrstr(const char *haystack, const char *needle)

注:以上几个函数,如果找不到data,就返回NULL。

这个链接不错:http://www.tutorialspoint.com/c_standard_library/string_h.htm

strstr strchr strrchr strrstr的更多相关文章

  1. strstr strchr strrchr

    通过函数的定义来区分: 1.strstr: 返回子串出现的第一次位置 char *strstr(const char *haystack, const char *needle) 可见,strstr函 ...

  2. php中strstr、strrchr、substr、stristr四个函数的区别总结

    php中strstr.strrchr.substr.stristr四个函数的区别总结 投稿:junjie 字体:[增加 减小] 类型:转载 时间:2014-09-22我要评论 这篇文章主要介绍了php ...

  3. php中strstr、strrchr、substr、stristr四个函数用法区别

    php中strstr.strrchr.substr.stristr四个函数用法区别: php中strstr strrchr substr stristr这四个字符串操作函数特别让人容易混淆,常用的是s ...

  4. strtok strchr strrchr strchrnul

    NAME       strchr, strrchr, strchrnul - locate character in string SYNOPSIS       #include <strin ...

  5. php使用strpos,strstr,strchr注意啦,若是数字查找则会当成ASCII码处理

    strpos,strstr,strchr都是查找某字符出现的位置,若未找到,则返回false(判断是===) 如: var_dump(strpos("oa",'97')); var ...

  6. php 截取字符串 strstr 和strrchr

    截取字符串 strstr 和strrchr 结果:(其中之一) strstr : 执行时间在0.10 - 0.19 之间 strrchr : 执行时间在0.095 - 0.19 之间 结论:从数十次执 ...

  7. PHP字符串函数之 strstr stristr strchr strrchr

    strstr -- 查找字符串的首次出现,返回字符串从第一次出现的位置开始到该字符串的结尾或开始. stristr -- strstr 函数的忽略大小写版本 strchr -- strstr 函数的别 ...

  8. php -- strpos,stripos,strrpos,strripos,strstr,strchr,stristr,strrchr

    strpos() 函数 语法: mixed strpos ( string $haystack , mixed $needle [, int $offset = 0 ] ) 查找 needle 在 h ...

  9. strstr()查找函数,strchr(),strrchr(),stristr()/strpos(),strrpos()查找字符串位置

    在一个较长的字符串这查找匹配的字符串或字符,其中strstr()和strchr()是完全一样的. 例: echo strstr('why always you','you'); 输出: you 如果为 ...

随机推荐

  1. LintCode:链表操作(合并与反转)

    描述: (1)翻转一个链表 样例 给出一个链表1->2->3->null,这个翻转后的链表为3->2->1->null ********************** ...

  2. vRA Customizing error

    toolsDeployPkg.log An error occurred while customizing VM vwbjvuqtest0751. For details reference the ...

  3. Spring与web.xml

    出处:http://blog.csdn.net/u010796790 在web.xml配置监听器 ContextLoaderListener (listener-class) ContextLoade ...

  4. 针对firefox ie6 ie7 ie8的css样式中的line-height属性

    针对firefox ie6 ie7 ie8的css样式中的line-height属性 以前我们大部分都是用!important来hack,对于ie6和firefox测试可以正常显示,但是ie7以上对! ...

  5. java中的Enumeration

    Enumeration en = pp.keys(); while(en.hasMoreElements()){ String key = (String)en.nextElement(); Syst ...

  6. html设置编码

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  7. 201621123014《Java程序设计》第四周学习总结

    1.本周学习总结 1.1 写出你认为本周学习中比较重要的知识点关键词 答:继承.多态.子类.父类.final.static.类型判断与类型转换.抽象类. 1.2 尝试使用思维导图将这些关键词组织起来. ...

  8. codeforces 553B B. Kyoya and Permutation(找规律)

    题目链接: B. Kyoya and Permutation time limit per test 2 seconds memory limit per test 256 megabytes inp ...

  9. 【leetcode刷题笔记】Plus One

    Given a non-negative number represented as an array of digits, plus one to the number. The digits ar ...

  10. git克隆某一个branch

    git clone -b <branch> <remote_repo> 例如: git clone -b 指定的分支名字