//查找字符串最后一个相匹配的串,不存在返回NULL, 存在返回出现的位置
//s1 目标串 s2 子串
char *strRstr( const char *s1, const char *s2 )
{
int len2 = 0;
if ( !(len2 = strlen(s2)) )
{
return (char*)s1;
}
char* pcRet = NULL;
size_t len1 = 0;
len1 = strlen(s1);
s1=s1+(len1-1);
for (size_t i=len1 ; i>0; i-- , --s1)
{
if ( *s1 == *s2 && strncmp( s1, s2, len2 )==0 )
{
pcRet = (char *)s1;
break;
}
}
return pcRet;
}