title: Concatenate a string before the last occurrence of any character
body: <p>I want to concatenate a string before the last occurrence of any character.</p>
  
  <p>I want to do something like this:</p>
  
  <pre><code>addToString(lastIndexOf(separator), string);
  </code></pre>
  
  <p>where <strong>"ddToString"</strong> is a function that would add the <strong>"string"</strong> before the <strong>"lastIndexOf(separator)"</strong></p>
  
  <p>Any ideas?</p>
  
  <p>One way I thought of is making <code>string = string + separator</code>.
  But, I can't figure out how to overload the concatenate function to concatenate after a particular index.</p>