title: How to remove whitespaces in strings in Swift?
body: <p>This works</p>
  
  <pre><code>let replaced = String(map(aString.generate()) {
      $0 == " " ? "-" : $0 })
  </code></pre>
  
  <p>and this doesn't</p>
  
  <pre><code>let replaced = String(map(aString.generate()) {
      $0 == " " ? "" : $0 })
  </code></pre>
  
  <p>Why?</p>