Issue 15 in ocaml-extlib: Why not?

3 views
Skip to first unread message

codesite...@google.com

unread,
May 8, 2010, 11:50:15 AM5/8/10
to ocaml-extlib-...@googlegroups.com
Status: New
Owner: ----

New issue 15 by apsheronets: Why not?
http://code.google.com/p/ocaml-extlib/issues/detail?id=15

Index: extlib/extString.ml
===================================================================
--- extlib/extString.ml (revision 382)
+++ extlib/extString.ml (working copy)
@@ -65,6 +65,25 @@
with
Exit -> !found

+let find_from str pos sub =
+ let sublen = length sub in
+ if sublen = 0 then
+ 0
+ else
+ let found = ref pos in
+ let len = length str in
+ try
+ for i = pos to len - sublen do
+ let j = ref 0 in
+ while unsafe_get str (i + !j) = unsafe_get sub !j do
+ incr j;
+ if !j = sublen then begin found := i; raise Exit; end;
+ done;
+ done;
+ raise Invalid_string
+ with
+ Exit -> !found
+
let exists str sub =
try
ignore(find str sub);
Index: extlib/extString.mli
===================================================================
--- extlib/extString.mli (revision 382)
+++ extlib/extString.mli (working copy)
@@ -36,6 +36,12 @@
within the string [s] or raises [Invalid_string] if [x]
is not a substring of [s]. *)

+ val find_from : string -> int -> string -> int
+ (** [find s i x] returns the starting index of the string [x]
+ within the string [s] after position i or raises [Invalid_string]
+ if [x] is not a substring of [s]. [find s x] is is equivalent to
+ [find_from s 0 x]. *)
+
val split : string -> string -> string * string
(** [split s sep] splits the string [s] between the first
occurrence of [sep].


--
You received this message because you are subscribed to the Google Groups "ocaml-extlib-notifications" group.
To post to this group, send email to ocaml-extlib-...@googlegroups.com.
To unsubscribe from this group, send email to ocaml-extlib-notifi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ocaml-extlib-notifications?hl=en.

codesite...@google.com

unread,
Mar 6, 2011, 9:21:11 AM3/6/11
to ocaml-extlib-...@googlegroups.com
Updates:
Status: Accepted
Labels: Milestone-Release1.6

Comment #1 on issue 15 by ygrekher...@gmail.com: Why not?
http://code.google.com/p/ocaml-extlib/issues/detail?id=15

(No comment was entered for this change.)

Reply all
Reply to author
Forward
0 new messages