Swift : Convert (cast) Character to Integer?




Problem :

How to convert (cast) character to integer in Swift programming language ?

Solution :

Simple. Just cast the character variable with Int() function. For example :

 let intchar = Int(character)

  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