title: convert array of string into Double in swift
body: <p>I'm trying to convert a string into a double in swift. I managed to extract the string from a website (www.x-rates.com) into an array but I cannot convert it after in a double in order to make some work around this number. Can anyone tell me what I'm supposed to do or what I did wrong? I know that my label don't update now but I will do it later, the first thing that I'm trying to do is the conversion.
  thx a lot!</p>
  
  <p>Here is the code:</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
      @IBOutlet weak var resultLabel: UILabel!        
      @IBOutlet weak var moneyTextField: UITextField!        
      @IBAction func convert(_ sender: Any) {
  
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view, typically from a nib.
  
  
          let url = URL(string: "https://www.x-rates.com/calculator/?from=EUR&amp;to=USD&amp;amount=1")!
  
          let request = NSMutableURLRequest(url : url) 
          let task = URLSession.shared.dataTask(with: request as URLRequest) {
          data, response, error in
  
              var message = ""
  
              if let error = error {
  
                  print(error)
              } else {
  
                  if let unwrappedData = data {
  
                      let dataString = NSString(data: unwrappedData, encoding: String.Encoding.utf8.rawValue)
  
                      var stringSeperator = "&lt;span class=\"ccOutputRslt\"&gt;"
  
                      if let contentArray = dataString?.components(separatedBy: stringSeperator){
                          if contentArray.count &gt; 0 {
                              stringSeperator = "&lt;span"
  
                             let newContentArray = contentArray[1].components(separatedBy: stringSeperator)
  
                              if newContentArray.count &gt; 0 {
  
                                  message = newContentArray[0]
  
                                  var message = Float(newContentArray[0])! + 10
  
                                  }                                   
                              }
                          }
                      }
                  }
  
              DispatchQueue.main.sync(execute: {
                  self.resultLabel.text = "the value of the dollar is " + message
  
              }           
          )}
          task.resume()
  
  
          func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  }
  </code></pre>