title: Swift 3: Converting numeric string to Bool, getting false for invalid values
body: <p>I have to convert strings usually containing an integer number into values of type <code>Bool</code>. The rule would be to get <code>true</code> or any non-zero value. But invalid numbers shall lead to <code>false</code>.</p>
  
  <p>If the strings were always valid numbers, the code would be like this:</p>
  
  <pre><code>let stringValue = "1"
  let boolValue = Int(stringValue) != 0
  </code></pre>
  
  <p>However, that doesn't work if <code>stringValue</code> is empty, because then the <code>Int()</code> function returns <code>nil</code>, and that is unequal to 0, thus the result ends up being <code>true</code> when I want <code>false</code>.</p>
  
  <p>What's an <em>elegant</em> way to solve this in Swift 3? I like to avoid extra lines with <code>if</code> clauses.</p>
  
  <p><em>Note: If the string could only contain "1" for <code>true</code> values, testing for <code>== 1</code> would be the answer. But I like to allow other non-zero values for <code>true</code> as well. In other words, I like to have any valid number other than 0 become <code>true</code>.</em></p>