|
|
1.1 ! root 1: ! 2: ! 3: strstr() String Function strstr() ! 4: ! 5: ! 6: ! 7: ! 8: Find one string within another ! 9: ! 10: #include <string.h> ! 11: cchhaarr *ssttrrssttrr(_s_t_r_i_n_g_1, _s_t_r_i_n_g_2); ! 12: cchhaarr *_s_t_r_i_n_g_1, *_s_t_r_i_n_g_2; ! 13: ! 14: strstr looks for string2 within string1. The terminating null ! 15: character is not considered part of string2. ! 16: ! 17: strstr returns a pointer to where string2 begins within string1, ! 18: or NULL if string2 does not occur within string1. ! 19: ! 20: For example, ! 21: ! 22: ! 23: char *string1 = "Hello, world"; ! 24: char *string2 = "world"; ! 25: strstr(string1, string2); ! 26: ! 27: ! 28: returns ssttrriinngg11 plus seven, which points to the beginning of ! 29: wwoorrlldd within HHeelllloo, wwoorrlldd. On the other hand, ! 30: ! 31: ! 32: char *string1 = "Hello, world"; ! 33: char *string2 = "worlds"; ! 34: strstr(string1, string2); ! 35: ! 36: ! 37: returns NULL because wwoorrllddss does not occur within HHeelllloo, wwoorrlldd. ! 38: ! 39: ***** See Also ***** ! 40: ! 41: string functions, string.h ! 42: ! 43: ! 44: ! 45: ! 46: ! 47: ! 48: ! 49: ! 50: ! 51: ! 52: ! 53: ! 54: ! 55: ! 56: ! 57: ! 58: ! 59: ! 60: ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.