ANY - check if a character appears in a string.

Alternate Entry Name: .ANY

Usage:

B:
   pos = any( char, string [, i] );
/* C users use "strchr" */

Where:

char
is a single ASCII character.
string
points to an ordinary string.
i
is a number less than the length of "string".
pos
is the position in which "char" was found in "string" if "char" was found; otherwise, "pos" receives -1.

Description:

ANY scans "string" for an occurrence of the character "char". If "i" is specified, the scan begins with the i'th character of "string". Otherwise, the scan begins at the start of "string". If ANY finds an occurrence of "char" in "string", it returns the position in which "char" was found. If "char" is not found, the value "-1" is returned.

Note that ANY considers the '*e' at the end of "string" to be part of "string"; thus if "char" has the value '*e', ANY will always find a match.

Example:

/* count all the occurrences of "="'s in "string" */
       for( count=i=0; i=any('=',string,i)+1 ; count++);

Copyright © 1996, Thinkage Ltd.