strchr(3) — Subroutines
NAME
rindex, index, strchr, strrchr − Search for character in string
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <string.h> char ∗rindex(
const char ∗s,
int c); char ∗index(
const char ∗s,
int c); char ∗strchr(
const char ∗s,
int c); char ∗strrchr(
const char ∗s,
int c);
PARAMETERS
sSpecifies the string to search.
cSpecifies a character, expressed as an int data type, to search for.
DESCRIPTION
The strchr() function locates the first occurrence of the integer specified by the c parameter, which is converted to a char, in the string pointed to by the s parameter. The terminating null character is treated as part of the string pointed to by the s parameter.
The strrchr() function locates the last occurrence of the integer specified by the c parameter, which is converted to a char value, in the string pointed to by the s parameter. The terminating null character is treated as a part of the string pointed to by the s parameter.
The rindex() and index() functions provide the same functionality as the strrchr() and strchr() functions, respectively. They are provided for compatibility with existing systems.
If c is a null byte (’\0’) in these functions, they locate the terminating null byte of s.
NOTES
AES Support Level:
Full use (strchr(), strrchr()).
RETURN VALUES
Upon successful completion, these functions return a pointer to the matching character in the scanned string. When the character specified by parameter c is not found, a null pointer is returned.