strstr(3) Library Functions Manual strstr(3) strstr, strcasestr - LIBRARY Standard C library (libc, -lc) #include char *strstr(const char *haystack, const char *needle); #define _GNU_SOURCE /* . feature_test_macros(7) */ #include char *strcasestr(const char *haystack, const char *needle); The strstr() function finds the first occurrence of the substring needle in the string haystack. The terminating null bytes ('\0') are not compared. strcasestr() strstr(), . NULL, . If needle is the empty string, the return value is always haystack itself. attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |strstr() | | MT-Safe | +----------------------------+----------------------------------------------------------+--------------------------+ |strcasestr() | | MT-Safe locale | +----------------------------+----------------------------------------------------------+--------------------------+ strstr() C11, POSIX.1-2008. strcasestr() GNU. strstr() POSIX.1-2001, C89. strcasestr() GNU. . memchr(3), memmem(3), strcasecmp(3), strchr(3), string(3), strpbrk(3), strsep(3), strspn(3), strtok(3), wcsstr(3) Alexander Golubev , Azamat Hackimov , Hotellook, Nikita , Spiros Georgaras , Vladislav , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . strstr(3)