strrchr
函数的声明:
char *strrchr(const char *str, char c)
str
为字符串,c
为被查找的字符;
该函数的作用:在str
中查找c
,返回c
在str
中最后一次出现的位置。
下面是一个简单的实例:
#include <stdio.h>
#include <stdlib.h>
#include <string>
#define CHAR '1'
int main()
{
const char *p;
const char f[20] = "ep1och13.7o";
p = strrchr(f,CHAR);
printf("%s\n",p);
system("pause");
return 0;
}
输出为:13.7o