1strstr(3)                  Library Functions Manual                  strstr(3)
2
3
4

NAME

6       strstr, strcasestr - locate a substring
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <string.h>
13
14       char *strstr(const char *haystack, const char *needle);
15
16       #define _GNU_SOURCE         /* See feature_test_macros(7) */
17       #include <string.h>
18
19       char *strcasestr(const char *haystack, const char *needle);
20

DESCRIPTION

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

RETURN VALUE

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

ATTRIBUTES

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

STANDARDS

49       strstr()
50              C11, POSIX.1-2008.
51
52       strcasestr()
53              GNU.
54

HISTORY

56       strstr()
57              POSIX.1-2001, C89.
58
59       strcasestr()
60              GNU.
61

SEE ALSO

63       memchr(3),  memmem(3), strcasecmp(3), strchr(3), string(3), strpbrk(3),
64       strsep(3), strspn(3), strtok(3), wcsstr(3)
65
66
67
68Linux man-pages 6.05              2023-07-20                         strstr(3)
Impressum