Swift : Convert (cast) String to Float
Problem :
You have a string value and you need to convert the string into type float.
Solution :
Use NSString for direct casting from type string to float. For example :
var StrToFloat = (SomeInputString.text as NSString).floatValue
See also : Swift : Convert (cast) String to Integer
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
+8.7k Golang : HTTP Routing with Goji example
+15.1k Golang : Accurate and reliable decimal calculations
+10.8k Nginx : TLS 1.2 support
+8.1k Golang : Check if integer is power of four example
+7.3k Golang : Convert source code to assembly language
+21.6k Golang : Convert string slice to struct and access with reflect example
+9.1k Golang : Create and shuffle deck of cards example
+30.4k Golang : Remove characters from string example
+7.6k Golang : get the current working directory of a running program
+18.4k Golang : Generate thumbnails from images
+26.7k Golang : Find files by extension
+12.5k Golang : Drop cookie to visitor's browser and http.SetCookie() example