Getting error in conversion of NSNumber to String in swift
<p>I am using CoreData to store the data.I am storing ContactNumber with the datatype of NSNumber. I am retrieving the data from DB like </p>

<pre><code>  let entityDescription =
            NSEntityDescription.entityForName("Retailer",
                inManagedObjectContext: managedObjectContext)

            let request = NSFetchRequest()
            request.entity = entityDescription

            do{
                let results = try managedObjectContext.executeFetchRequest(request)


                for test in results
                {


                    print(test.valueForKey("address") as? String)
                     print(test.valueForKey("classes") as? String)
                     print(test.valueForKey("contactnumber") as! NSNumber)
                     print(test.valueForKey("landmark") as? String)
                    print(test.valueForKey("name") as? String)
                    print(test.valueForKey("outlettype") as? String)
                    print(test.valueForKey("retailername") as? String)
                     print(test.valueForKey("type") as? String)
                    print(test.valueForKey("credit") as? String)


      self.arrayOfData.append((StoringClass(retailersname: (test.valueForKey("retailername") as? String)!, names: (test.valueForKey("name") as? String)!, outlettypes: (test.valueForKey("outlettype") as? String)!, types: (test.valueForKey("type") as? String)!, credits: (test.valueForKey("credit") as? String)!, landmarks: (test.valueForKey("landmark") as? String)!, classestype: (test.valueForKey("classes") as? String)!, addresses: (test.valueForKey("address") as? String)!, contactnumbers:s)))

                }
</code></pre>

<p>But my problem is I am getting the ContactNumber as “-27790.000000” like that.
I tried to convert the NSNumber to String but it doesn’t work for me.</p>

<pre><code> let s:String = String(format:"%f",  test.valueForKey("contactnumber")!.doubleValue)

print(s) - output:  “-27790.000000” 
</code></pre>

<p>Can anyone tell me what mistake I am doing.</p>

<p>ThanksIn Advance</p>