Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
String wishes for Ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1997-07-02 (17:22)
From: Basile STARYNKEVITCH <Basile.Starynkevitch@c...>
Subject: String wishes for Ocaml

Hello All,

[[abreged french version below]]

I have some few small (except the 3rd) wishes for next Ocaml release,
regarding string processing:

1. some more basic string utilities in the standard Ocaml library (not
the Str package), like
   * strchr in C :
      String.pos str ch = 
        search ch in str returning first position or raise Not_found

   * strrchr in C :
      String.last_pos str ch = 
        search ch in str returning last position or raise Not_found

   * String.substr str first last = get a substring of str from index
     first to last      (String.sub takes a length, not a last index)

2. perhaps something similar to strtok in C (but reentrant)

3. Much harder. A sort of scanf facility. Perhaps the format could be
a list of formatting element...

I know that this last point is difficult. Actually, the Format.printf
type inference mechanism (which seems built in the compiler, not in
the library) is stiff a bit of magic for me.

[[-- version française abrégée - lire plutot l'anglais ci-dessus --]]

Quelques souhaits pour la prochaine version d'Ocaml relatifs aux
chaines de caractères.

1. Quelques utilitaires manquants, a la maniere de strchr & strrchr en
Ansi C. Ainsi que substr qui renvoie la sous-chaine de premier et
dernier rangs données

2. Quelques chose comme strtok en C

3. Bien plus difficile. Un scanf ou equivalent. Mais c'est difficile,
et pour moi, l'inference de type de Format.printf (qui me parait être
dans le compilateur, pas la librarie) reste magique pour moi.

Merci à tous

N.B. Any opinions expressed here are solely mine, and not of my organization.
N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.

Basile STARYNKEVITCH   ----  Commissariat à l Energie Atomique 
DRN/DMT/SERMA * CEA/Saclay bat.470 * 91191 GIF/YVETTE CEDEX * France
fax: (33) 01,; phone: 01,; home: 01,
email: Basile . Starynkevitch @ cea . fr  (but remove white space)
I speak french, english, russian. Je parle français, anglais, russe.