Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ () — Coherent 3.1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


strstr()                 String Function                 strstr()




Find one string within another

#include <string.h>
char *strstr(string1, string2);
char *string1, *string2;

strstr looks  for string2  within string1.  The  terminating null
character is not considered part of string2.

strstr returns a  pointer to where string2 begins within string1,
or NULL if string2 does not occur within string1.

For example,


        char *string1 = "Hello, world";
        char *string2 = "world";
        strstr(string1, string2);


returns  string1 plus  seven, which  points  to the  beginning of
world within Hello, world.  On the other hand,


        char *string1 = "Hello, world";
        char *string2 = "worlds";
        strstr(string1, string2);


returns NULL because worlds does not occur within Hello, world.

***** See Also *****

string functions, string.h






















COHERENT Lexicon                                           Page 1


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026