any(3C)
_________________________________________________________________
any function
Determine if a string contains a specific character.
_________________________________________________________________
Calling Sequence
char c, *str;
int res, any();
res = any(c, str);
Description
Use the any function to determine if a string contains a
character you specify.
Returns
The any function returns 1 if the specified character occurs in
the string. Otherwise, it returns 0.
Related Functions
See also the equal, verify, strpbrk, signcmp, and strcmp
functions.
Example
/* Program test for the any() function */
#include <stdio.h>
char c, *string;
int result, any();
main(argc, argv)
int argc;
char *argv[];
{
c = argv[1][0];
string = argv[2];
result = any(c, string);
printf("The string:\n\t%s\n%s the character %c.\n",
string, result == 1 ? "contains" : "does not contain",
c);
}
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
any(3C)
If you call the program test with arguments y and
cathode_ray_tube, the output will be the following:
The string:
cathode_ray_tube
contains the character y.
If you call it with arguments n and cathode_ray_tube, the output
will be
The string:
cathode_ray_tube
does not contain the character n.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)