-
Notifications
You must be signed in to change notification settings - Fork 88
string index
Walt K edited this page Aug 1, 2018
·
2 revisions
string-index return the index of the first occurrence of char in str. Returns #f if char is not present.
| Parameter | Description |
|---|---|
| str | Input string |
| a-char | The character searched for |
| comp | Optional: The comparison operator, if not specified it is char=? |
Example 1: Find first position of "(" bracket in a string.
> (define str "[(a,v,b)]")
> (string-index str #\()
Example 2: Find first position of an x or X in the string.
> (define str "A X B X C")
> (string-index str #\x char-ci=?)