beautypg.com

Strrchr function, Strspn function, Strrchr – Zilog Z80380 User Manual

Page 84: Strspn

background image

Library Functions

Run Time Environment

4–20

UM004001-COR1103

strrchr

FUNCTION

Header file statement:

#include

Syntax:

char *strrchr

(const char *string, int c);

The strrchr function finds the last occurrence of c (converted to char) in string. The string’s
terminating null character (‘\0’) is included in the search. (Use strchr to find the first occur-
rence of c in string.)

Return Value

This function returns a pointer to the last occurrence of the character in the string. A NULL
pointer is returned if the given character is not found.

strspn

FUNCTION

Header file statement:

#include

Syntax:

size_t strspn

( const char *string1, const char *string2 );

The strspn function returns the index of the first character in string1 that does not belong to
the set of characters specified by string2. This value is equivalent to the length of the initial
substring of string1 that consists entirely of characters from string2 . The null character (‘\0’)
terminating string2 is not considered in the matching process. If string1 begins with a charac-
ter not in string2, strspn returns 0.

Return Value

This function returns an integer value specifying the length of the segment in string1 consist-
ing entirely of characters in string2.

Parameter

Description

string

Searched string

c

Character to be located

Parameter

Description

string1

Searched string

string2

Character set