title: Remove last punctuation of a swift string
body: <p>I'm trying to remove the last punctuation of a string in swift 2.0</p>
  
  <pre><code>var str: String = "This is a string, but i need to remove this comma,      \n"
  var trimmedstr: String = str.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
  </code></pre>
  
  <p>First I'm removing the the white spaces and newline characters at the end, and then I need to check of the last character of <code>trimmedstr</code> if it is a punctuation. It can be a period, comma, dash, etc, and if it is i need to remove it it.</p>
  
  <p>How can i accomplish this?</p>