Swift : Convert (cast) String to Float



Tags : swift string convert 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

Affiliate :

Hire Golang Developers


  See also : Swift : Convert (cast) String to Integer



Tags : swift string convert float

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