title: Split a string into list of words' characters in Ocaml
body: <p>So, I have homework and I'm doing my best to solve it.
  We have to translate from English to Morse code.
  Every word has to be separated. </p>
  
  <p>Example: if I enter <code>this is</code> it should write: <code>["_";"....";"..";"..."]["..";"...."]</code></p>
  
  <p>I wrote 2 functions so far (lowercase to uppercase and matching letters and numbers with Morse code) and now I need to write function which converts string to a list of list of characters like this:</p>
  
  <pre><code>stringSAllCaps "   ban an  a  ";;
  - : char list list = [['B'; 'A'; 'N']; ['A'; 'N']; ['A']]
  stringSAllCaps "banana";;
  - : char list list = [['B'; 'A'; 'N'; 'A'; 'N'; 'A']]
  </code></pre>
  
  <p>I know how to convert a string into a list of characters, but have no idea what to do next. I don't need someone to solve that for me completely, just to guide me in right direction.</p>
  
  <p>This is what I have done:</p>
  
  <pre><code>let explode niz =
    let rec exp a b =
      if a &lt; 0 then b 
      else exp (a - 1) (niz.[a] :: b) in
    exp (String.length niz - 1) []
       ;;
  </code></pre>
  
  <p>edit:</p>
  
  <p>ty for your help :)
  I've managed to solve this problem, but not like this. I will post it later.
  as I solved it and continued with my homework I realized that I had to use <code>while</code> and <code>pointers</code> and now I'm stuck again (pointers are not my best friends.. ). Any suggestions?</p>
  
  <p>my solution at the moment:</p>
  
  <pre><code># let explode str =
  let rec exp = function
  | a, b when a &lt; 0 -&gt; b
  | a, b -&gt; exp (a-1, str.[a]::b)
  in
  exp ((String.length str)-1, []);;
  # let split lst ch =
  let rec split = function
  | [], ch, cacc', aacc' -&gt; cacc'::aacc'
  | c::lst, ch, cacc', aacc' when c = ch -&gt; split (lst, ch, [], cacc'::aacc')
  | c::lst, ch, cacc', aacc' -&gt; split (lst, ch, c::cacc', aacc')
  in
  split (lst, ch, [], []);;
  </code></pre>