I want to convert the value of Int64 variable to String. String(x) is not working here.
Asked
Active
Viewed 513 times
-4
-
2https://docs.swift.org/swift-book/LanguageGuide/TheBasics.html – Asperi Aug 10 '22 at 12:41
-
2Hi Sajib, I also think is a good idea to check out the link that Asperi provided in the comment before. But could you also please add some code that is not working. E.g. when I create a Int64 variable (var number) and I use it (String(number)) in a SwiftUI Text, in a print command or even in a new variable/constant (let intToNumber = String(number)), it works well for me. – Sebastian Fox Aug 10 '22 at 13:23
-
Does this answer your question? [Convert Int to String in Swift](https://stackoverflow.com/questions/24161336/convert-int-to-string-in-swift) – Iva Aug 11 '22 at 05:14
1 Answers
1
let number: Int64 = 64
let string: String = "\(number)"
print(string)
output
64
Program ended with exit code: 0

Blacksmith
- 199
- 7