title: How can I remove the last character of a String in Swift 4?
body: <p>How do I remove the last character of a string in Swift 4? I used to use <code>substring</code> in earlier versions of Swift, but the <code>substring</code> method is deprecated.</p>
  
  <p>Here's the code I have.</p>
  
  <pre><code>temp = temp.substring(to: temp.index(before: temp.endIndex))
  </code></pre>