chickadee » srfi-130 » string-contains-right

string-containsprocedure
string-contains-rightprocedure

Does string s1 contain string s2?

Returns the cursor in s1 referring to the first character of the first/last instance of s2 as a substring, or #f if there is no match. The optional start / end indexes restrict the operation to the indicated substrings.

The returned cursor is in the range [start1, end1). A successful match must lie entirely in the [start1, end1) range of s1.

Note that the result is always a cursor, even when start1 and end1 are indexes. Use string-cursor->index to convert a cursor result to an index.

(string-contains "eek--what a geek." "ee"
                 12 18) ; Searches "a geek"
    => {Cursor 15}

The name of this procedure does not end with a question mark--this is to indicate that it does not return a simple boolean (#t or #f). Rather, it returns either #f or a cursor.