Scala: Remove the last occurrence of a character
<p>I am trying to remove the last occurrence of a character in a string. I can get its <code>index</code>:</p>

<pre><code>str.lastIndexOf(',')
</code></pre>

<p>I have already tried to use <code>split</code> and the <code>replace</code> function on the string.</p>