From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA00759; Fri, 20 Feb 2004 20:35:24 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA28196 for ; Fri, 20 Feb 2004 20:35:21 +0100 (MET) Received: from bob.west.spy.net (mail.west.spy.net [66.149.231.226]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i1KJZJae001155 for ; Fri, 20 Feb 2004 20:35:20 +0100 Received: from [10.9.254.254] (sjc-dist3-e3.2wire.com [63.203.253.2]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client did not present a certificate) by bob.west.spy.net (Postfix) with ESMTP id 27A6D5B50; Fri, 20 Feb 2004 11:35:15 -0800 (PST) In-Reply-To: <20040220172813.GB8332@redhat.com> References: <20040220172813.GB8332@redhat.com> Mime-Version: 1.0 (Apple Message framework v612) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: caml-list@inria.fr From: Dustin Sallings Subject: Re: [Caml-list] [repost] Request for more String functions Date: Fri, 20 Feb 2004 11:34:39 -0800 To: Richard Jones X-Mailer: Apple Mail (2.612) X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 char:01 regex:01 val:01 char:01 val:01 bool:01 bool:01 int:01 int:01 overhead:03 string:03 string:03 wrote:03 stuff:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Feb 20, 2004, at 9:28, Richard Jones wrote: > Another difficulty I find is doing search and replace on strings, in > simple cases where the overhead of a regular expression probably isn't > warranted. For example, escaping all '<' characters in a string with > '<'. It would be nice to have a Search.char_replace function to do > this. I ran into problems with just plain search first. My programs are 4x faster with plain splits and searches than regex. Here's some of the stuff I've added: val split : string -> char -> int -> string list val split_chars : string -> char list -> int -> string list val strstr : string -> string -> int -> int val ends_with : string -> string -> bool val begins_with : string -> string -> bool val string_of_chars : char list -> string -- Dustin Sallings ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners