title: AppleScript: Index of substring in string
body: <p>I want to create a function that returns a substring of a specific string from the beginning of said string up to but not including the start of another specific string. Ideas?</p>
  
  <hr>
  
  <p>So something like:</p>
  
  <pre><code>substrUpTo(theStr, subStr)
  </code></pre>
  
  <p>so if I inputted <code>substrUpTo("Today is my birthday", "my")</code>, it would return a substring of the first argument up to but not including where the second argument begins. (i.e. it would return <code>"Today is "</code>)</p>