pub fn str_index_of_f(s1: &str, s2: &str, s3: usize) -> i64
Expand description
Finds the zero-based index of the nth occurrence of a substring s2
within the string s1
, starting the search at position s3
.
The function iteratively searches for the substring s2
in s1
, updating the starting position with each found occurrence while ensuring that it does not exceed the length of s1
.
If the search exceeds the bounds of s1
or if s2
is not found, the function returns -1
.
Otherwise, it returns the index of the nth occurrence of s2
, offset by 1
due to incrementing result
.