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
+7.8k Golang : Decompress zlib file example
+3.3k Golang : How to deal with configuration data?
+12.8k Golang : Generate universally unique identifier(UUID) example
+7.9k CodeIgniter : Load different view for mobile devices
+20.1k Golang : Get time.Duration in year, month, week or day
+16.3k Golang : Join arrays or slices example
+7k Golang : Intercept and process UNIX signals example
+5.7k Golang : Simple histogram example
+10.3k Golang : Adding XML attributes to xml data or use attribute to differentiate a common tag name
+7k Golang : Resolve domain name to IP4 and IP6 addresses.
+5.5k Golang : Temperatures conversion example
+3.7k Golang : Error handling methods