title: How to masking the last number in Swift?
body: <p>How to mask the last string using swift, I have made the code as below. but the code only shows the last number, my expectation is that the code displays the first 5 digits</p>
  
  <p>here my code:</p>
  
  <pre><code>extension StringProtocol {
      var masked: String {
          return String(repeating: "•", count: Swift.max(0, count-5)) + suffix(5)
      } }
  
  var name = "0123456789"
  
  print(name.masked)
  </code></pre>
  
  <p>I get output: •••••56789</p>
  
  <p>but my expectations: 01234•••••</p>