Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Re:code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dimitri Ara <dimitri.ara@m...>
Subject: Re: [Caml-list] Re:code
Sudhapaturi@aol.com a écrit :

> I am very new in this. I wanted to write a code to get a match for the 
> following.
> If a word is given it should search where the vowels are ?
> for example a word like structure .
> Can you please tell me How I can do that?

I'm not sure i understood what you want. Here is a function 
vowels_pos such as (vowels_pos s) is a list of position of vowels
in the word s.

let vowels_pos s =
  let pos = ref [] in
  for i = 0 to String.length s - 1 do
    match s.[i] with
    | 'a' | 'e' | 'i' | 'o' | 'u' -> pos := i :: !pos
    | _ -> ()
  done ;
  !pos

-- 
> Notre devoir, pour leur bien et pour le bien de Linux, est de te
> flinguer avant que tu ne les sacrifies (fût-ce avec les meilleures
> intentions du monde).
-+- TP In: Guide du linuxien pervers : "De la pédagogie par l'Exemple"
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr