

index()                  String Function                  index()




Find a character in a string

cchhaarr *iinnddeexx(_s_t_r_i_n_g, _c) cchhaarr *_s_t_r_i_n_g; cchhaarr _c;

index  scans the  given string  for the  first occurrence  of the
character c.  If  c is found, index returns a  pointer to it.  If
it is not found, index returns NULL.

Note that  having iinnddeexx search  for a null  character will always
produce a pointer to the end of a string.  For example,


        char *string;
        assert(index(string, 0)==string+strlen(string));


will never fail.

***** Example *****

For an example of this function, see the entry for ssttrrnnccppyy.

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

pnmatch(), rindex(), string functions

***** Notes *****

This  function is  identical  to the  function  strchr, which  is
described in the  ANSI standard.  COHERENT includes strchr in its
libraries.  It is recommended that it be used instead of index so
that programs  more closely  approach strict conformity  with the
ANSI standard.























COHERENT Lexicon                                           Page 1


