strstr3
String search substring
Usage
#include <string.h>
char *strstr(const char *haystack, const char *needle);
Library
Standard C library (libc, -lc)
Overview
strstr() finds the first occurrence of the substring needle in the string haystack.
The terminating null bytes ('\0') are not compared.
It is equivalent to
memmem(haystack, strlen(haystack), needle, strlen(needle))
Return value
strstr(3) returns a pointer to the beginning of the located substring, or NULL if the substring is not found.
If needle is the empty string, the return value is always haystack itself.
Attributes
For an explanation of the terms used in this section, see attributes(7).
| Interface | Attribute | Value |
| strstr() | Thread safety | MT-Safe |
Releases
19 releases since Debian 1.1 (Buzz); the text changed 14 times.