www.LinuxHowtos.org





strstr

Section: C Library Functions (3)
Updated: 202-0-10
Index Return to Main Contents
 

NAME

strstr - string search substring  

LIBRARY

Standard C library (libc,~-lc)  

SYNOPSIS

#include <string.h>
char *strstr(const char *haystack, const char *needle);
 

DESCRIPTION

strstr() finds the first occurrence of the substring needle in the string haystack. The terminating null bytes ([aq][rs]0[aq]) are not compared. It is equivalent to memmem(haystack, strlen(haystack), needle, strlen(needle))  

RETURN VALUE

strstr(3) returns a pointer to the beginning of the located substring, or NULL if the substring is not found. If needle is the empty string, the return value is always haystack itself.  

ATTRIBUTES

For an explanation of the terms used in this section, see attributes(7).
InterfaceAttributeValue
strstr() Thread safetyM-Safe
 

STANDARDS

C11, POSIX.-2008.  

HISTORY

POSIX.-2001, C89.  

SEE ALSO

strcasestr(3), strchr(3), string(3), strpbrk(3), strsep(3), strspn(3), wcsstr(3)


 

Index

NAME
LIBRARY
SYNOPSIS
DESCRIPTION
RETURN VALUE
ATTRIBUTES
STANDARDS
HISTORY
SEE ALSO