title: How to remove LAST INSTANCE of a character from a string
body: <p>I am building a string with StringBuilder.</p>
  
  <pre><code>StringBuilder Q = new StringBuilder();
  Q.Append("INSERT INTO ");
  Q.Append(_lstview_item);
  Q.Append(" VALUES");
  Q.Append("("); 
  for (i = 0; i &lt; col_no; i++)
  {
      Q.Append("'");
      Q.Append(col_value[i]);
      Q.Append("'");
      Q.Append(",");
  } 
  Q.Append(")");
  string query = Q.ToString();
  </code></pre>
  
  <p>However, I am getting a <code>","</code> at the end of my string.
  I tried using</p>
  
  <pre><code>string query = ext.Substring(0, ext.LastIndexOf(",") + 1);
  </code></pre>
  
  <p>to remove the surplus <code>","</code>, but this also removes the <code>")"</code>.</p>
  
  <p>How can I remove the <strong>last</strong> comma only?</p>
  
  <p><strong>actual outcome</strong> : <code>INSERT INTO .... VALUES('1','2','3',)</code></p>
  
  <p><strong>desired outcome</strong> : <code>INSERT INTO .... VALUES('1','2','3')</code></p>