strstr, _fstrstr
raw OCR
Scans a string for the occurrence of a given substring.
Defined in header <string.h>
Syntax
#include <string.h>
Near version: char *strstr(const char *sl, const char *s2);
Far version: char far * far _fstrstr(const char far *sl, const char far *sl)
Portability
| DOS | UNIX | Windows | ANSI C | C++ only | |
|---|---|---|---|---|---|
| Near version | ■ | ■ | ■ | ■ | |
| ■ | ■ |
Remarks
Strstr scans si for the first occurrence of the substring s2.
Return value
strstr returns a pointer to the element in si, where s2 begins (points to s2 in si). If s2 does not occur in si, strstr returns null.
Example
#include <stdio.h>
#include <string.h>
int main(void)
{
char *strl = "Borland International", ''str2 = "nation", *ptr;
ptr = strstr(strl, str2);
printf("The substring is: %s\n", ptr)
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `strstr, Jstrstr` read as `strstr, _fstrstr`
Stable link: /3.1/string.h/strstr/
· short form /3.1/strstr/