Swift : Convert (cast) Float to String
Problem :
You have a float value and you need to convert the float into string type in Swift.
Solution :
Use NSString function to cast the float value into string type. For example :
let floatNum = 123.456789
let str = NSString(format: "%.3f", floatNum)
Reference :
See also : Swift : Convert (cast) String to Float
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+9.8k Golang : Load ASN1 encoded DSA public key PEM file example
+15.4k Golang : Accurate and reliable decimal calculations
+13.8k Golang : Activate web camera and broadcast out base64 encoded images
+6.1k Golang : Experimenting with the Rejang script
+13.7k Golang : Query string with space symbol %20 in between
+8.5k Your page has meta tags in the body instead of the head
+7.5k Golang : Accessing dataframe-go element by row, column and name example
+6.9k Golang : Calculate pivot points for a cross
+4.5k Linux/MacOSX : Search and delete files by extension
+7.9k Golang : Load DSA public key from file example
+8.9k Golang : HTTP Routing with Goji example
+36.4k Golang : Convert(cast) int64 to string