mirror of
https://github.com/TheRealOwenRees/pgn_to_tex.git
synced 2026-11-18 04:42:07 +00:00
9 lines
244 B
OCaml
9 lines
244 B
OCaml
let contains ~needle haystack =
|
|
let n = String.length needle and h = String.length haystack in
|
|
let rec loop i =
|
|
if i + n > h then false
|
|
else if String.sub haystack i n = needle then true
|
|
else loop (i + 1)
|
|
in
|
|
n = 0 || loop 0
|