Use new String.is_suffix function.

master
Bernhard Schommer 2020-05-04 11:12:22 +02:00
parent e00d7f3a42
commit ddb1b5e4b5
No known key found for this signature in database
GPG Key ID: 7924A6E9B4AB4F73
1 changed files with 1 additions and 3 deletions

View File

@ -100,9 +100,7 @@ module Unix : SYSDEPS = struct
&& (String.length n < 2 || String.sub n 0 2 <> "./")
&& (String.length n < 3 || String.sub n 0 3 <> "../")
let check_suffix name suff =
String.length name >= String.length suff &&
String.sub name (String.length name - String.length suff)
(String.length suff) = suff
String.ends_with ~suffix:suff name
let chop_suffix_opt ~suffix filename =
let len_s = String.length suffix and len_f = String.length filename in