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
+40.4k Golang : How to check if a string contains another sub-string?
+5.7k Golang : Get Hokkien(福建话)/Min-nan(閩南語) Pronounciations
+6.7k Golang : Transform lisp or spinal case to Pascal case example
+15.9k CodeIgniter/PHP : Create directory if does not exist example
+9.5k Golang : Find and replace data in all files recursively
+11.9k Golang : Extract part of string with regular expression
+18.5k Golang : Clearing slice
+17k Golang : Iterate linked list example
+7k Golang : Individual and total number of words counter example
+26.2k Golang : Find files by extension
+16.6k Golang : Covert map/slice/array to JSON or XML format
+5.3k Unix/Linux : Get reboot history or check when was the last reboot date