title: Finding start and end position of a word in a string in java
body: <p>What is the best way for for finding start and end  position of a "substring" in a sentence?</p>
  
  <p>for example for sentence <code>"This is my first program"</code>, by giving the substring <code>"my first"</code> It should return <code>start position=2</code> and <code>end position=4</code>.</p>