title: Swift 4.0 Right Padding a String
body: <p>I padded a Swift String up to X amount of characters.  Which is the most efficient way to achieve this in Swift 4.0?</p>
  
  <p><strong>Option 1</strong></p>
  
  <pre><code>extension String {
      mutating func right_padding(padding: Int, padding_char: Character) {
          let idx = self.endIndex
          for _ in (1...padding) {
              self.insert(padding_char, at: idx)
          }
      }
  }
  </code></pre>
  
  <p><strong>Option 2</strong>
  SO article: <a href="https://stackoverflow.com/questions/32338137/padding-a-swift-string-for-printing">Padding a swift String for printing</a></p>
  
  <pre><code>let test = "ghost" + "\(String(repeatElement("!", count: 40)))"
  </code></pre>
  
  <p><strong>Option 3</strong></p>
  
  <p><code>???</code></p>
  
  <p>Option 2 seems the simplest &amp; most efficient, but I may be missing a better way...</p>