1STRSTR(3)                  Linux Programmer's Manual                 STRSTR(3)
2
3
4

NAME

6       strstr, strcasestr - locate a substring
7

SYNOPSIS

9       #include <string.h>
10
11       char *strstr(const char *haystack, const char *needle);
12
13       #define _GNU_SOURCE
14
15       #include <string.h>
16
17       char *strcasestr(const char *haystack, const char *needle);
18

DESCRIPTION

20       The  strstr() function finds the first occurrence of the substring nee‐
21       dle in the string haystack.  The terminating '\0'  characters  are  not
22       compared.
23
24       The  strcasestr()  function  is  like strstr(), but ignores the case of
25       both arguments.
26

RETURN VALUE

28       These functions return a pointer to the beginning of the substring,  or
29       NULL if the substring is not found.
30

CONFORMING TO

32       The  strstr() function conforms to C89 and C99.  The strcasestr() func‐
33       tion is a non-standard extension.
34

BUGS

36       Early versions of Linux libc (like 4.5.26) would  not  allow  an  empty
37       needle  argument  for strstr().  Later versions (like 4.6.27) work cor‐
38       rectly, and return haystack when needle is empty.
39

SEE ALSO

41       index(3), memchr(3), rindex(3), strcasecmp(3),  strchr(3),  strpbrk(3),
42       strsep(3), strspn(3), strtok(3), wcsstr(3), feature_test_macros(7)
43

COLOPHON

45       This  page  is  part of release 3.22 of the Linux man-pages project.  A
46       description of the project, and information about reporting  bugs,  can
47       be found at http://www.kernel.org/doc/man-pages/.
48
49
50
51GNU                               2005-04-05                         STRSTR(3)
Impressum