C语言之strrchr函数
【FROM MSDN && 百科】
原型:char *strrchr(const char *str, char c);
#include<string.h>
找一个字符c在另一个字符串str中末次出现的位置(也就是从str的右侧开始查找字符c首次出现的位置),并返回从字符串中的这个位置起,一直到字符串结束的所有字符。如果未能找到指定字符,那么函数将返回NULL。
The strrchr function finds the last occurrence of c (converted to char) in str. The search includes the terminating null character.
DEMO:
- #include <stdio.h>
- #include <conio.h>
- #include <string.h>
- #pragma warning (disable:4996)
- int main(void)
- {
- char string[20];
- char *ptr;
- char c='r';
- strcpy(string,"There are two rings");
- ptr=strrchr(string,c);
- //ptr=strchr(string,c);
- if (ptr!=NULL)
- {
- printf("The character %c is at position:%s\n",c,ptr);
- }
- else
- {
- printf("The character was not found\n");
- }
- getch();
- return 0;
- }
C语言之strrchr函数的更多相关文章
- 【转】 strrchr()函数---C语言
转自:https://baike.baidu.com/item/strrchr/4621437?fr=aladdin 函数名称: strrchr 函数原型:char *strrchr(const ...
- strrchr函数
C语言函数 函数简介 函数名称: strrchr 函数原型:char *strrchr(char *str, char c); 所属库: string.h 函数功能:查找一个字符c在另一个字符串str ...
- C语言常用字符串函数总结
ANSI C中有20多个用于处理字符串的函数: 注意:const 形参使用了const限定符,表示该函数不会改变传入的字符串.因为源字符串是不能更改的. strlen函数: 函数原型:unsigned ...
- Atitit java方法引用(Method References) 与c#委托与脚本语言js的函数指针
Atitit java方法引用(Method References) 与c#委托与脚本语言js的函数指针 1.1. java方法引用(Method References) 与c#委托与脚本语言js ...
- C语言字符串匹配函数
C语言字符串匹配函数,保存有需要时可以用: #include <stdio.h> #include <stdlib.h> #include <string.h> # ...
- 转:C语言字符串操作函数 - strcpy、strcmp、strcat、反转、回文
转自:C语言字符串操作函数 - strcpy.strcmp.strcat.反转.回文 C++常用库函数atoi,itoa,strcpy,strcmp的实现 作者:jcsu C语言字符串操作函数 1. ...
- [转]SQLITE3 C语言接口 API 函数简介
SQLITE3 C语言接口 API 函数简介 说明:本说明文档属作者从接触 SQLite 开始认识的 API 函数的使用方法, 由本人翻译, 不断更新. /* 2012-05-25 */ int sq ...
- (转)PHP的语言结构和函数的区别
相信大家经常看到对比一些PHP应用中,说用isset() 替换 strlen(),isset比strlen执行速度快等. 例子: if ( isset($user) ) { //do some thi ...
- Java之--Java语言基础组成—函数
Java语言基础组成-函数 Java语言由8个模块构成,分别为:关键字.标识符(包名.类名.接口名.常量名.变量名等).注释.常量和变量.运算符.语句.函数.数组. 本片主要介绍Java中的函数,函数 ...
随机推荐
- Redis集合-Set
sadd 向一个Set中添加数据 127.0.0.1:6379> sadd set01 1 1 2 2 3 3 (integer) 3127.0.0.1:6379> SMEMBERS se ...
- 【BZOJ-2521】最小生成树 最小割
2521: [Shoi2010]最小生成树 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 415 Solved: 242[Submit][Statu ...
- Nuget-使用图形化界面打包自己的类库
到NuGet相对于我们最重要的功能是能够搭建自己的NuGet服务器,实现公司内部类库的轻松共享更新.在安装好NuGet扩展后,我们已经能够通过NuGet轻松下载自己需要的类库,下面来说一说如何将自己的 ...
- HDU1150 Machine Schedule
匈牙利算法 目前为止还是半懂不懂的状态 #include<iostream> #include<cstdio> #include<cstring> using na ...
- espcms /public/class_connector.php intval truncation Vul Arbitrary User Login
catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 Relevant Link:2. 漏洞触发条件3. 漏洞影响范围4. 漏 ...
- GoJS使用
1. 先学习官网的这篇Get Started with GoJS教程入门,了解GoJS基础知识: 2. 浏览GoJS各个示例(Samples.Intro),找到契合自己业务需要的某个或者某几个例子,然 ...
- type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds int,java.lang.Object
今天在进行代码检查的时候出现下面的异常: type parameters of <T>T cannot be determined; no unique maximal instance ...
- JSP+JavaBean+Servlet+Oracle新增功能中对Date类型的字段的处理
Oracle库中userinfo表borth字段是Date类型,age年纪字段是int类型.age字段要根据borth来自动计算 先说一下我遇到的问题: insert into的时候遇到日期转换类型错 ...
- web前端开发修炼之道--编写高质量代码
想想自己的页面实现是否糟糕 Web标准--结构.样式和行为的分离 Web标准可分为三个部分:结构标准.样式标准.行为标准. 结构标准包括XML标准.XHTML标准.HTML标准 样式标准主要是指的CS ...
- 逐行读取txt文件
header("Content-type:text/html; charset=utf-8"); $handle = fopen('test.php', 'r') or die(' ...