Finding a character in a string

### 5.2.11 Finding a character in a string

The inString command tests to see if a string contains a character.

- inString takes two arguments:
  - str, a string.
  - c, a character.
- inString(str,c) returns the index of its first occurrence of the character c in the string str, or -1 if c does not occur in str.

#### Examples

inString("abcded","d")

3 |  |  |  |  |  |  |  |  |  |

inString("abcd","e")

−1 |  |  |  |  |  |  |  |  |  |