|
|
1.1 ! root 1: ! 2: ! 3: index() String Function index() ! 4: ! 5: ! 6: ! 7: ! 8: Find a character in a string ! 9: ! 10: cchhaarr *iinnddeexx(_s_t_r_i_n_g, _c) cchhaarr *_s_t_r_i_n_g; cchhaarr _c; ! 11: ! 12: index scans the given string for the first occurrence of the ! 13: character c. If c is found, index returns a pointer to it. If ! 14: it is not found, index returns NULL. ! 15: ! 16: Note that having iinnddeexx search for a null character will always ! 17: produce a pointer to the end of a string. For example, ! 18: ! 19: ! 20: char *string; ! 21: assert(index(string, 0)==string+strlen(string)); ! 22: ! 23: ! 24: will never fail. ! 25: ! 26: ***** Example ***** ! 27: ! 28: For an example of this function, see the entry for ssttrrnnccppyy. ! 29: ! 30: ***** See Also ***** ! 31: ! 32: pnmatch(), rindex(), string functions ! 33: ! 34: ***** Notes ***** ! 35: ! 36: This function is identical to the function strchr, which is ! 37: described in the ANSI standard. COHERENT includes strchr in its ! 38: libraries. It is recommended that it be used instead of index so ! 39: that programs more closely approach strict conformity with the ! 40: ANSI standard. ! 41: ! 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.