title: Swift 4 string range of a certain character
body: <p>I'm trying to make a function in string that deletes some characters from a provided string.</p>
  
  <p>For example i have </p>
  
  <pre><code>"‌Boll %b‌ (Teeth ‌Alligator‌ (13,8,8,5,5,3,n),20,2,ma)"
  </code></pre>
  
  <p>and i want to edit this to</p>
  
  <pre><code>"‌Boll %b‌"
  </code></pre>
  
  <p>which means to delete everything between the <code>"("</code> and <code>")"</code></p>
  
  <p>So i've made this function</p>
  
  <pre><code>func deleteInnerString(with string: String, from firstCharacter: String, to secondCharacter: String) -&gt; String {
      guard let leftIndex = (string.range(of: firstCharacter)?.lowerBound),
          let rightIndex = string.range(of: secondCharacter)?.lowerBound else {
              return string
      }
      let remainingString = String(string.prefix(upTo: leftIndex) + string.suffix(from: string.index(after: rightIndex)))
      return remainingString
  }
  </code></pre>
  
  <p>but in this case the output string is</p>
  
  <pre><code>"‌Boll %b‌ ,20,2,ma)"
  </code></pre>
  
  <p>The question is, how can i scan the string to find the last closing parenthesis range??</p>