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
+12k Golang : GTK Input dialog box examples
+14.8k Golang : GUI with Qt and OpenCV to capture image from camera
+9.9k Golang : Format strings to SEO friendly URL example
+8.7k Golang : Progress bar with ∎ character
+10.7k Golang : Generate 403 Forbidden to protect a page or prevent indexing by search engine
+14k Golang : Get current time
+11.3k Google Maps URL parameters configuration
+36.2k Golang : Get file last modified date and time
+12k Golang : Convert decimal number(integer) to IPv4 address
+9.5k Golang : How to get username from email address
+17k Golang : Read integer from file into array
+30.5k Golang : How to verify uploaded file is image or allowed file types