title: Splitting a string at at every element of a specified vector
body: <p>I am wrestling with a problem for which I was sure there was an easy solution, but I haven't been able to find it. Thanks for any help. </p>
  
  <p>I'm trying to split a string of text, whenever an element of a separate vector occurs. Something like the following: </p>
  
  <pre><code>fruits&lt;-c("APPLE","BANANA","ORANGE")
  string&lt;-("This is a list of fruits and their properties. 
           APPLE This is a red fruit, typically very SWEET! 
           BANANA This is a yellow fruit, also sweet! 
           ORANGE This is an orange fruit and also, yes, sweet")
  </code></pre>
  
  <p>My desired output is a list/vector of 4 elements, each of which contains the splits of the strings before/after any of the elements of 'fruits' occurs. So, something like:</p>
  
  <pre><code>c("This is a list of fruits and their properties",
  "APPLE This is a red fruit, typically very SWEET!",
  "BANANA This is a yellow fruit, also sweet!,
  "ORANGE This is an orange fruit and also, yes, sweet")
  </code></pre>
  
  <p>I have tried</p>
  
  <pre><code>strsplit(string,split=fruits)
  </code></pre>
  
  <p>As well as a couple of other things, but with no success. What I'm actually trying to do is split a .pdf codebook that I've converted into .txt by a list of words (countries), that correspond to sections of the codebook. </p>
  
  <p>Thanks in advance! </p>