let rec contains_string s1 p1 s2 =
let ls1 = length s1 in
let ls2 = length s2 in
try let pos = index_from s1 p1 s2.[0] in
if ls1 - pos < ls2 then None
else if eq_sub_strings s1 pos s2 0 ls2 then
Some pos else contains_string s1 (pos + 1) s2
with Not_found -> None