What is the most efficient way to remove all the spaces, \\n and \\r in a String in Swift?
\\n
\\r
I have tried:
for character in s
For Swift 4:
let myString = "This \n is a st\tri\rng" let trimmedString = myString.components(separatedBy: .whitespacesAndNewlines).joined()