summaryrefslogtreecommitdiff
path: root/stdlib/filename.mli
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2018-11-08 08:50:39 +0100
committerGitHub <noreply@github.com>2018-11-08 08:50:39 +0100
commita7a76fd4e8bd0d5ddce6857c0eed1f8652f720b6 (patch)
tree5913ef670f8f6f2d9efa2afe1a76b1569947e504 /stdlib/filename.mli
parent0e5cae8dc6ed1eed4dd73e0f502ced0a1781b5a3 (diff)
downloadocaml-a7a76fd4e8bd0d5ddce6857c0eed1f8652f720b6.tar.gz
Filename.chop_suffix_opt (#2125)
Diffstat (limited to 'stdlib/filename.mli')
-rw-r--r--stdlib/filename.mli25
1 files changed, 23 insertions, 2 deletions
diff --git a/stdlib/filename.mli b/stdlib/filename.mli
index fa6f036989..b05ad0d2e7 100644
--- a/stdlib/filename.mli
+++ b/stdlib/filename.mli
@@ -42,12 +42,33 @@ val is_implicit : string -> bool
val check_suffix : string -> string -> bool
(** [check_suffix name suff] returns [true] if the filename [name]
- ends with the suffix [suff]. *)
+ ends with the suffix [suff].
+
+ Under Windows ports (including Cygwin), comparison is
+ case-insensitive, relying on [String.lowercase_ascii]. Note that
+ this does not match exactly the interpretation of case-insensitive
+ filename equivalence from Windows. *)
val chop_suffix : string -> string -> string
(** [chop_suffix name suff] removes the suffix [suff] from
the filename [name]. The behavior is undefined if [name] does not
- end with the suffix [suff]. *)
+ end with the suffix [suff]. It is thus recommmended to use
+ [chop_suffix_opt] instead.
+*)
+
+val chop_suffix_opt: suffix:string -> string -> string option
+(** [chop_suffix_opt ~suffix filename] removes the suffix from
+ the [filename] if possible, or returns [None] if the
+ filename does not end with the suffix.
+
+ Under Windows ports (including Cygwin), comparison is
+ case-insensitive, relying on [String.lowercase_ascii]. Note that
+ this does not match exactly the interpretation of case-insensitive
+ filename equivalence from Windows.
+
+ @since 4.08
+*)
+
val extension : string -> string
(** [extension name] is the shortest suffix [ext] of [name0] where: