title: Splitting string on certain word into ArrayList - java
body: <p>I am stuck splitting a string into pieces to store the pieces into an ArrayList. I can split the string onto <code>" "</code>, but I'd like to split the string onto <code>"farmersmarket"</code> and store it into an <code>Arraylist</code>. To be able to return one of the indexed pieces of string.</p>
  
  <pre><code>    ArrayList&lt;String&gt; indexes = new ArrayList&lt;String&gt;();
      String s = file; 
  
      for(String substring: s.split(" ")){
          indexes.add(substring);
          }
      System.out.println(indexes.get(2));
  </code></pre>
  
  <p>Any ideas to split a string on <code>"farmersmarket"</code>?</p>