title: How to remove a suffix from end of string?
body: <p>I want to:</p>
  <ol>
  <li>Check a variable and determine if the last 2 characters are &quot;Id&quot;</li>
  <li>If yes, remove them.</li>
  </ol>
  <p>I can do it with this below, but then it will blow up if there is an &quot;Id&quot; substring other than the end.  Is there a RemoveFromEnd() method that takes a number of characters argument?</p>
  <pre><code> if (column.EndsWith(&quot;Id&quot;))
   {
         //remove last 2 characters
         column = column.replace(&quot;Id&quot;, &quot;&quot;);
   }
  </code></pre>
  <p>I see <a href="http://www.dotnetperls.com/remove-string-end" rel="nofollow noreferrer">this solution</a>, which does this:</p>
  <pre><code>column = System.Text.RegularExpressions.Regex.Replace(column, &quot;Id$&quot;, &quot;&quot;);
  </code></pre>
  <p>but it says it's pretty slow and I am going to be running this code inside a code block that I would like to be extremely fast so I wanted to see if a faster solution is available.</p>