File:  [MW Coherent from dump] / coherent / a / usr / man / ALL / strstr
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:34 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent



strstr()                 String Function                 strstr()




Find one string within another

#include <string.h>
cchhaarr *ssttrrssttrr(_s_t_r_i_n_g_1, _s_t_r_i_n_g_2);
cchhaarr *_s_t_r_i_n_g_1, *_s_t_r_i_n_g_2;

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  ssttrriinngg11 plus  seven, which  points  to the  beginning of
wwoorrlldd within HHeelllloo, wwoorrlldd.  On the other hand,


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


returns NULL because wwoorrllddss does not occur within HHeelllloo, wwoorrlldd.

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

string functions, string.h






















COHERENT Lexicon                                           Page 1



unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.