📄 strrpbrk.c
字号:
/* +++Date last modified: 05-Jul-1997 */
/*
** strrpbrk() - reverse of strpbrk() - Finds the last occurrence of
** any characters from szChars found in szString.
**
** Donated to SNIPPETS by Phi Nguyen 1995, modified by Bob Stout
*/
#include <stdio.h>
#include <string.h>
#include "snip_str.h"
#if defined(__cplusplus) && __cplusplus
extern "C" {
#endif
char *strrpbrk(const char *szString, const char *szChars)
{
const char *p;
char *p0, *p1;
for (p = szChars, p0 = p1 = NULL; p && *p; ++p)
{
p1 = strrchr(szString, *p);
if (p1 && p1 > p0)
p0 = p1;
}
return p0;
}
#if defined(__cplusplus) && __cplusplus
}
#endif
#ifdef TEST
main()
{
char string[] = "This is a testing string",
chars[] = "xyzet",
*ptr;
ptr = strrpbrk(string, chars);
if (ptr)
printf("One or more of \"%s\" found at \"%s\"\n", chars, ptr);
else printf("Can't find any of \"%s\" in \"%s\".\n", chars, string);
return 0;
}
#endif /* TEST */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -