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
+39.7k Golang : How to check if a string contains another sub-string?
+4.3k Responsive Google Adsense
+12.8k Android Studio : Use image as AlertDialog title with custom layout example
+15.8k Golang : XML to JSON example
+12.5k Golang : unknown escape sequence error
+15.1k Golang :Trim white spaces from a string
+14.8k Golang : How to check if input from os.Args is integer?
+5.2k Javascript : Generate random key with specific length
+8.7k Golang : Identifying Golang HTTP client request
+17.3k Golang : Write file with io.WriteString
+19.2k Golang : Saving private and public key to files
+16.1k Golang : When to use init() function?