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.8k Golang : Translate language with language package example
+9.7k Golang : Generate random elements without repetition or duplicate
+5k Java : Human readable password generator
+9.2k Golang : How to profile or log time spend on execution?
+13.1k Golang : How to get URL port?
+29.4k Golang : bufio.NewReader.ReadLine to read file line by line
+7.6k Golang : Set or add headers for many or different handlers
+25.5k Golang : How to check if a connection to database is still alive ?
+20.7k Golang : How to run Golang application such as web server in the background or as daemon?
+18.9k Nginx + FastCGI + Go Setup.
+11.9k Golang : Handle or parse date string with Z suffix(RFC3339) example
+12.9k Golang : Get uploaded file name or access uploaded files