This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,20 @@
open Astring
(* Total *)
let find_all p s =
let rec loop acc i = match String.find ~start:i p s with
| None -> List.rev acc
| Some i -> loop (i :: acc) (i + 1)
in
loop [] 0
(* Not total *)
let find_all p s =
let rec loop acc i =
if i > String.length s then List.rev acc else
match String.find ~start:i p s with
| None -> List.rev acc
| Some i -> loop (i :: acc) (i + 1)
in
loop [] 0