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
+6.7k Golang : Calculate BMI and risk category
+8k Golang : Metaprogramming example of wrapping a function
+35.8k Golang : How to split or chunking a file to smaller pieces?
+8.3k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared
+8.7k Golang : How to capture return values from goroutines?
+14.3k Golang : How to get URL port?
+14.3k Golang : Execute function at intervals or after some delay
+17.8k Golang : Check if a directory exist or not
+6.4k Golang : Join lines with certain suffix symbol example
+8.1k Your page has meta tags in the body instead of the head
+9.8k Golang : Read file and convert content to string
+17.7k Golang : Convert IPv4 address to decimal number(base 10) or integer