Swift : Convert (cast) String to Integer




Problem :

How to convert (cast) String to Integer value in Swift programming language ?

Solution :

Just cast the String variable with toInt() functon. For example :

 var Numbers = "1234"
 var NumbersFromString = Numbers.toInt()

Reference :

https://developer.apple.com/library/mac/documentation/General/Reference/SwiftStandardLibraryReference/index.html

  See also : Swift : Convert (cast) Int to String ?





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