let index_of_character t ?(from=0) c =
let from = if from <= 0 then 0 else min (length t) from in
let res = ref None in
try
for i = from to length t - 1 do
if S.get t i = c then (res:= Some i; raise Not_found)
done;
None
with _ -> !res