Code Snippet: Print All Integers in a String
From Coder Merlin
Revision as of 13:33, 7 December 2018 by Chukwuemeka-tinashe (talk | contribs)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Print All Integers in a String[edit]
var line : String?
repeat {
line = readLine()
if let text = line {
for character in text {
if ("0" ... "9").contains(character) {
print(character)
}
}
}
} while line != nil