Reputation: 866
I'm getting weird values when trying to initialize a String with Swift.Float
types.
(lldb) po venue.rating().floatValue.dynamicType
Swift.Float
(lldb) po venue.rating().floatValue
9.2
(lldb) po String(format: "%.1f", [venue.rating().floatValue])
"30746195630460679147717820231031193600.0"
(lldb) po String(format: "%@", [venue.rating().floatValue])
"(\n \"9.2\"\n)"
How would I initialize a String
with a Swift.Float
type?
Upvotes: 0
Views: 44
Reputation: 29896
let someString = "\(someFloat)"
let someString2 = NSString(format: "%.3f", someFloat2)
Upvotes: 2