pub fn str_indexof(s1: &SmtString, s2: &SmtString, i: i32) -> i32
Expand description
Index of the first occurrence of s2 in s1, starting from index i
- If 0 <= i < s1.len and s2 occurs in s1[i ..] then return the index j >= i of the first occurrence of s2 in s1[i ..].
- Return -1 if i < 0 or i >= s1.len or s2 does not occur in s1[i ..]
ยงExamples
use aws_smt_strings::smt_strings::*;
let s1 = SmtString::from("abcdef");
let s2 = SmtString::from("cde");
let s3 = SmtString::from("cdd");
assert_eq!(str_indexof(&s1, &s2, 0), 2);
assert_eq!(str_indexof(&s1, &s2, 2), 2);
assert_eq!(str_indexof(&s1, &s2, 3), -1);
assert_eq!(str_indexof(&s1, &s3, 0), -1);