let sub t ~index ~length = if length = 0 then Some empty else try Some (String.sub t index length) with e -> None