.TH strchr() "" "" "String Function (libc)"
.PC "Find a character in a string"
.B "#include <string.h>"
\fBchar *strchr(\fIstring\^\fB, \fIcharacter\^\fB)\fR
\fBchar *\fIstring\^\fB; int \fIcharacter\^\fB;\fR
.PP
.II "character, search for in string"
.II "search for character in a string"
.II "string, search for character in"
.II index()
.B strchr()
searches for the first occurrence of
.I character
within
.IR string .
The null character at the end of
.I string
is included within the search.
It is equivalent to the \*(PN function \fBindex()\fR.
.PP
.B strchr()
returns a pointer to the first occurrence of
.I character
within
.IR string .
If
.I character
is not found, it returns NULL.
.PP
Having \fBstrchr()\fR search for a null character will always produce a
pointer to the end of a string.
For example,
.DM
	char *string;
	assert(strchr(string, '\e0') == string + strlen(string));
.DE
.PP
never fails.
.SH "See Also"
.Xr "libc," libc
.Xr "string.h" string.h
.br
\*(AS, \(sc7.11.5.2
.br
\*(PX Standard, \(sc8.1
