Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ () — Coherent 3.1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


index()                  String Function                  index()




Find a character in a string

char *index(string, c) char *string; char 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 index 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 strncpy.

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


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026