title: Converting a String decimal to a float or double in Swift?
body: <p>I'm trying to convert a String such as "3.9" to a Float value in Swift that will be represented as 3.9 (which can then be used in calculations).
  I'm running into issues here as the conversion doesn't seem to be going right, my code looks like this:</p>
  
  <pre><code>var a:Float = (lastNumber as NSString).floatValue
  var b:Float = (answerField!.text! as NSString).floatValue
  if (operatorLabel?.text == "+"){
        println(a)
     }
  </code></pre>
  
  <p>I'm trying to make a basic calculator app, as you can see. However, when I print the "a" value, it shows up as an error (11db) and I'm not sure how to approach this issue. Any thoughts? I'm thinking right now that I might be having a problem because the period in "3.9" isn't being converted to a decimal point, but I'm not sure.</p>