strrpbrk.c
来自「国外网站上的一些精典的C程序」· C语言 代码 · 共 51 行
C
51 行
/*** 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" {#endifchar *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 TESTmain(){ 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 + =
减小字号Ctrl + -
显示快捷键?