Previous Up Next

5.4.10  Find a character in a string: inString

inString takes two arguments: a string S and a character c.
inString tests if the character c is in the string S.
inString returns the index of its first occurrence or -1 if c is not in S.
Input:

inString("abcded","d")

Output:

3

Input:

inString("abcd","e")

Output:

-1

Previous Up Next