File:  [MW Coherent from dump] / coherent / a / usr / man / ALL / index
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



index()                  String Function                  index()




Find a character in a string

cchhaarr *iinnddeexx(_s_t_r_i_n_g, _c) cchhaarr *_s_t_r_i_n_g; cchhaarr _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 iinnddeexx 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 ssttrrnnccppyy.

***** 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



unix.superglobalmegacorp.com

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