English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] [repost] Request for more String functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-02-20 (19:35)
From: Dustin Sallings <dustin@s...>
Subject: Re: [Caml-list] [repost] Request for more String functions

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
> '&lt;'.  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