Skip to content

Commit

Permalink
Tests de borne moins severes dans contains
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2317 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
xavierleroy committed Mar 1, 1999
1 parent 3f5b0fc commit 4d49336
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stdlib/string.ml
Expand Up @@ -144,7 +144,7 @@ let rec index_rec s lim i c =
let index s c = index_rec s (length s) 0 c;;

let index_from s i c =
if i < 0 || i >= length s then invalid_arg "String.index_from" else
if i < 0 || i > length s then invalid_arg "String.index_from" else
index_rec s (length s) i c;;

let rec rindex_rec s i c =
Expand All @@ -158,11 +158,11 @@ let rindex_from s i c =
rindex_rec s i c;;

let contains_from s i c =
if i < 0 || i >= length s then invalid_arg "String.contains_from" else
if i < 0 || i > length s then invalid_arg "String.contains_from" else
try ignore(index_rec s (length s) i c); true with Not_found -> false;;

let rcontains_from s i c =
if i < 0 || i >= length s then invalid_arg "String.rcontains_from" else
try ignore(rindex_rec s i c); true with Not_found -> false;;

let contains s c = s <> "" && contains_from s 0 c;;
let contains s c = contains_from s 0 c;;

0 comments on commit 4d49336

Please sign in to comment.