In this answer, I have shared how to convert Int to string in Swift? Use the following example:
1 2 | let x : Int = 42 var myString = String(x) |
And the other way around – converting String to Int:
1 2 3 4 5 6 | let myString : String = "42" let x: Int? = myString.toInt() if (x != nil) { // Successfully converted String to Int } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.