strchr, strrchr
locate character in string
- Provided by: manpages-dev (Version: 6.18-1)
- Source: manpages
- Report a bug
locate character in string
Standard C library (libc, -lc)
#include <string.h>
char *strchr(const char *s, int c); char *strrchr(const char *s, int c);
memchr(s, c, strlen(s) + 1)
strpbrk(s, (char [2]){c, '\0'})
memrchr(s, c, strlen(s) + 1)
The strchr() and strrchr() functions return a pointer to the matched character or NULL if the character is not found. The terminating null byte is considered part of the string, so that if c is specified as '\0', these functions return a pointer to the terminator.
For an explanation of the terms used in this section, see attributes(7).
| Interface | Attribute | Value |
| strchr (), strrchr () | Thread safety | MT-Safe |
C11, POSIX.1-2008.
POSIX.1-2001, C89, SVr4, 4.3BSD.
memchr(3), string(3), strchrnul(3), strlen(3), strnul(3), strpbrk(3), strsep(3), strspn(3), strstr(3), strtok(3), wcschr(3), wcsrchr(3)