From 699b370220a8b87d5a948cc5b9dec7b50a19ce91 Mon Sep 17 00:00:00 2001 From: Alexander Lucas Date: Wed, 1 Jan 2025 09:34:06 -0500 Subject: [PATCH] Updated String and StringLabels interfaces to reflect `take_while`, `rtake_while`. --- src/core/CCString.mli | 6 ++++-- src/core/CCStringLabels.mli | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/core/CCString.mli b/src/core/CCString.mli index 3cca9365..e280c381 100644 --- a/src/core/CCString.mli +++ b/src/core/CCString.mli @@ -184,11 +184,13 @@ val take : int -> string -> string val take_while : (char -> bool) -> string -> string (** [take_while p s] keeps only the longest prefix [t] of [s] such that every - character [c] in [t] satisfies [p c]. *) + character [c] in [t] satisfies [p c]. + @since 3.16 *) val rtake_while : (char -> bool) -> string -> string (** [rtake_while p s] keeps only the longest suffix [t] of [s] such that every - character [c] in [t] satisfies [p c]. *) + character [c] in [t] satisfies [p c]. + @since 3.16 *) val drop : int -> string -> string (** [drop n s] removes the [n] first chars of [s]. diff --git a/src/core/CCStringLabels.mli b/src/core/CCStringLabels.mli index 318e8237..a3d4f358 100644 --- a/src/core/CCStringLabels.mli +++ b/src/core/CCStringLabels.mli @@ -193,6 +193,16 @@ val take : int -> string -> string (** [take n s] keeps only the [n] first chars of [s]. @since 0.17 *) +val take_while : p:(char -> bool) -> string -> string +(** [take_while ~p s] keeps only the longest prefix [t] of [s] such that every + character [c] in [t] satisfies [p c]. + @since 3.16 *) + +val rtake_while : p:(char -> bool) -> string -> string +(** [rtake_while ~p s] keeps only the longest suffix [t] of [s] such that every + character [c] in [t] satisfies [p c]. + @since 3.16 *) + val drop : int -> string -> string (** [drop n s] removes the [n] first chars of [s]. @since 0.17 *)