IBM's REXX language has a function called VERIFY that performs what I am looking for:
Given two strings: string and reference:
returns a number that, by default, indicates whether string is composed only of characters from reference; returns 0 if all characters in string are in reference, or returns the position of the first character in string not in reference.
For example, I want to search a string to ensure that it only contains vowels:
str = "foo bar" /* search string */
ref = "aeiou" /* reference string */
loc = VERIFY(str, ref) /* "1" (in REXX, indexes start at 1) */
Is there a C function that will do this? All I could find so far involves manual testing with each character (lots of OR's) in a loop.