2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" References consulted:
7 .\" Linux libc source code
8 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
10 .\" Modified Sat Jul 24 17:56:43 1993 by Rik Faith (faith@cs.unc.edu)
11 .\" Added history, aeb, 980113.
12 .\" 2005-05-05 mtk: added strcasestr()
14 .TH strstr 3 (date) "Linux man-pages (unreleased)"
16 strstr, strcasestr \- locate a substring
19 .RI ( libc ", " \-lc )
22 .B #include <string.h>
24 .BI "char *strstr(const char *" haystack ", const char *" needle );
26 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
27 .B #include <string.h>
29 .BI "char *strcasestr(const char *" haystack ", const char *" needle );
34 function finds the first occurrence of the substring
38 The terminating null bytes (\[aq]\e0\[aq]) are not compared.
44 but ignores the case of both arguments.
46 These functions return a pointer to the beginning of the
47 located substring, or NULL if the substring is not found.
52 the return value is always
56 For an explanation of the terms used in this section, see
64 Interface Attribute Value
67 T} Thread safety MT-Safe
70 T} Thread safety MT-Safe locale
77 POSIX.1-2001, POSIX.1-2008, C99.
81 function is a nonstandard extension.