Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
Library Functions
 2012 Microchip Technology Inc.
DS52053B-page 367
See Also
strcpy()
, strcat(), strlen(), strcmp()
Return Value
The destination buffer  
s1
 is returned.
STRPBRK 
Synopsis
#include <string.h>
 
char * strpbrk (const char * s1, const char * s2)
Description
The 
strpbrk()
 function returns a pointer to the first occurrence in string 
s1
 of any 
character from string 
s2
, or a null if no character from 
s2
 exists in 
s1
.
Example
#include <stdio.h>
#include <string.h>
void 
main (void)
{
    char * str = "This is a string.";
    while(str != NULL) {
        printf("%s\n", str);
        str = strpbrk(str+1, "aeiou");
    }
}
Return Value
 to the first matching character, or NULL if no character found.
STRRCHR, STRRICHR 
Synopsis
#include <string.h>
 
char * strrchr (char * s, int c)
char * strrichr (char * s, int c)
Description
The 
strrchr()
 function is similar to the 
strchr()
 function, but searches from the end 
of the string rather than the beginning; i.e., it locates the last occurrence of the charac-
ter 
c
 in the null terminated string 
s
. If successful it returns a pointer to that occurrence, 
otherwise it returns NULL.
The 
strrichr()
 function is the case-insensitive version of this function.