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         /* See feature_test_macros(7) */
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 null bytes ('\0') 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  located  sub‐
29       string, or NULL if the substring is not found.
30

ATTRIBUTES

32       For   an   explanation   of   the  terms  used  in  this  section,  see
33       attributes(7).
34
35       ┌─────────────┬───────────────┬────────────────┐
36Interface    Attribute     Value          
37       ├─────────────┼───────────────┼────────────────┤
38strstr()     │ Thread safety │ MT-Safe        │
39       ├─────────────┼───────────────┼────────────────┤
40strcasestr() │ Thread safety │ MT-Safe locale │
41       └─────────────┴───────────────┴────────────────┘

CONFORMING TO

43       strstr(): POSIX.1-2001, POSIX.1-2008, C89, C99.
44
45       The strcasestr() function is a nonstandard extension.
46

SEE ALSO

48       index(3), memchr(3), memmem(3),  rindex(3),  strcasecmp(3),  strchr(3),
49       string(3), strpbrk(3), strsep(3), strspn(3), strtok(3), wcsstr(3)
50

COLOPHON

52       This  page  is  part of release 5.07 of the Linux man-pages project.  A
53       description of the project, information about reporting bugs,  and  the
54       latest     version     of     this    page,    can    be    found    at
55       https://www.kernel.org/doc/man-pages/.
56
57
58
59GNU                               2019-03-06                         STRSTR(3)
Impressum