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       #include <string.h>
15
16       char *strcasestr(const char *haystack, const char *needle);
17

DESCRIPTION

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

RETURN VALUE

27       These functions return a pointer to the beginning of the  located  sub‐
28       string, or NULL if the substring is not found.
29
30       If  needle is the empty string, the return value is always haystack it‐
31       self.
32

ATTRIBUTES

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

CONFORMING TO

46       strstr(): POSIX.1-2001, POSIX.1-2008, C89, C99.
47
48       The strcasestr() function is a nonstandard extension.
49

SEE ALSO

51       index(3),  memchr(3),  memmem(3),  rindex(3), strcasecmp(3), strchr(3),
52       string(3), strpbrk(3), strsep(3), strspn(3), strtok(3), wcsstr(3)
53

COLOPHON

55       This page is part of release 5.13 of the Linux  man-pages  project.   A
56       description  of  the project, information about reporting bugs, and the
57       latest    version    of    this    page,    can     be     found     at
58       https://www.kernel.org/doc/man-pages/.
59
60
61
62GNU                               2021-08-27                         STRSTR(3)
Impressum