mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
change the semantics of CCString.find_all (allow overlaps)
This commit is contained in:
parent
ce6d981973
commit
7c9633f06f
2 changed files with 3 additions and 2 deletions
|
|
@ -222,7 +222,7 @@ let find_all ?(start=0) ~sub =
|
|||
let res = Find.find ~pattern s !i in
|
||||
if res = ~-1 then None
|
||||
else (
|
||||
i := res + Find.pattern_length pattern;
|
||||
i := res + 1; (* possible overlap *)
|
||||
Some res
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ val find : ?start:int -> sub:string -> string -> int
|
|||
*)
|
||||
|
||||
val find_all : ?start:int -> sub:string -> string -> int gen
|
||||
(** [find_all ~sub s] finds all occurrences of [sub] in [s]
|
||||
(** [find_all ~sub s] finds all occurrences of [sub] in [s], even overlapping
|
||||
instances.
|
||||
@param start starting position in [s]
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue