Skip to content

Commit

Permalink
String: change order of arguments in starts_with and ends_with
Browse files Browse the repository at this point in the history
to match extlib
ref ocaml#9533 (comment)
  • Loading branch information
ygrek committed Dec 30, 2020
1 parent fc5061c commit 51cfb5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions stdlib/string.ml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ let capitalize_ascii s =
let uncapitalize_ascii s =
B.uncapitalize_ascii (bos s) |> bts

let starts_with ~prefix s =
let starts_with s ~prefix =
let len_s = length s
and len_pre = length prefix in
let rec aux i =
Expand All @@ -206,7 +206,7 @@ let starts_with ~prefix s =
else aux (i + 1)
in len_s >= len_pre && aux 0

let ends_with ~suffix s =
let ends_with s ~suffix =
let len_s = length s
and len_suf = length suffix in
let diff = len_s - len_suf in
Expand Down
4 changes: 2 additions & 2 deletions stdlib/string.mli
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ val compare : t -> t -> int
behaves like {!Stdlib.compare} on strings but may be more efficient. *)

val starts_with :
prefix (* comment thwarts tools/sync_stdlib_docs *) :string -> string -> bool
string -> prefix (* comment thwarts tools/sync_stdlib_docs *) :string -> bool
(** [starts_with ][~][prefix s] is [true] iff [s] starts with [prefix].
@since 4.12.0 *)

val ends_with :
suffix (* comment thwarts tools/sync_stdlib_docs *) :string -> string -> bool
string -> suffix (* comment thwarts tools/sync_stdlib_docs *) :string -> bool
(** [ends_with suffix s] is [true] iff [s] ends with [suffix].
@since 4.12.0 *)
Expand Down
4 changes: 2 additions & 2 deletions stdlib/stringLabels.mli
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ val compare : t -> t -> int
behaves like {!Stdlib.compare} on strings but may be more efficient. *)

val starts_with :
prefix (* comment thwarts tools/sync_stdlib_docs *) :string -> string -> bool
string -> prefix (* comment thwarts tools/sync_stdlib_docs *) :string -> bool
(** [starts_with ][~][prefix s] is [true] iff [s] starts with [prefix].
@since 4.12.0 *)

val ends_with :
suffix (* comment thwarts tools/sync_stdlib_docs *) :string -> string -> bool
string -> suffix (* comment thwarts tools/sync_stdlib_docs *) :string -> bool
(** [ends_with ~suffix s] is [true] iff [s] ends with [suffix].
@since 4.12.0 *)
Expand Down

0 comments on commit 51cfb5b

Please sign in to comment.