strchrnul
string search character or NUL
- Provided by: manpages-dev (Version: 6.18-1)
- Source: manpages
- Report a bug
string search character or NUL
Standard C library (libc, -lc)
#define _GNU_SOURCE /* See feature_test_macros(7) */ #include <string.h>
char *strchrnul(const char *s, int c);
The strchrnul() function is like strchr(3) except that if c is not found in s, then it returns a pointer to the null byte at the end of s.
It is equivalent to both of the following expressions:
strchr(s, c) ?: strnul(s)
s + strcspn(s, (char [2]){c, '\0'})
The strchrnul() function returns a pointer to the matched character, or a pointer to the null byte at the end of s if the character is not found.
For an explanation of the terms used in this section, see attributes(7).
| Interface | Attribute | Value |
| strchrnul () | Thread safety | MT-Safe |
GNU.
glibc 2.1.1, FreeBSD 10, NetBSD 8.