let strip ?(on=`Both) ?(whitespace=S.is_whitespace) t =     let open S in     let first_non () =       match find t ~f:(fun c -> not (whitespace c)) with       | None -> raise Not_found | Some s -> s in     let last_non () =       match find_reverse t ~f:(fun c -> not (whitespace c)) with       | None -> raise Not_found | Some s -> s in     try       match on with       | `Both ->         let index = first_non () in         let last = last_non () in         sub_exn t ~index ~length:(last - index + 1)       | `Left ->         let index = first_non () in         sub_exn t ~index ~length:(length t - index)       | `Right ->         let last = last_non () in         sub_exn t ~index:0 ~length:(last + 1)     with     | Not_found -> empty