title: Scala subString function
body: <p>Hi I am looking for a solution it will return a substring from string for the given indexes.For avoiding index bound exception currently using if and else check.Is there a better approach(functional).</p>
  
  <pre><code>def subStringEn(input:String,start:Int,end:Int)={
    // multiple if check for avoiding index out of bound exception
      input.substring(start,end)
  }
  </code></pre>