title: How to remove a specific character from a string, only when it is the first or last character in the string.
body: <p>Suppose I have a string <code>1,2,3,</code>  I would like to remove the last <code>,</code> or if the string looks like <code>,1,2,3,</code> or   <code>,1,2,3</code> I would still like to get <code>1,2,3</code> as my result. 
  And please try to be a little explanatory in your answer. I do not just want to copy paste stuff without understanding it. Thank you.</p>