Справочник Пользователя для Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1
Модели
SW006021-1
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 368
2012 Microchip Technology Inc.
Example
#include <stdio.h>
#include <string.h>
void
main (void)
{
char * str = "This is a string.";
while(str != NULL) {
printf("%s\n", str);
str = strrchr(str+1, ’s’);
}
}
See Also
strchr()
, strlen(), strcmp(), strcpy(), strcat()
Return Value
A pointer to the character, or NULL if none is found.
STRSPN
Synopsis
#include <string.h>
size_t strspn (const char * s1, const char * s2)
Description
The
strspn()
function returns the length of the initial segment of the string pointed to
by
s1
which consists entirely of characters from the string pointed to by
s2
.
Example
#include <stdio.h>
#include <string.h>
void
main (void)
{
printf("%d\n", strspn("This is a string", "This"));
printf("%d\n", strspn("This is a string", "this"));
}
See Also
strcspn()
Return Value
The length of the segment.
STRSTR, STRISTR
Synopsis
#include <string.h>
char * strstr (const char * s1, const char * s2)
char * stristr (const char * s1, const char * s2)