How to remove any special characters in a string? Example: , or in string with Swift 3.
I try to remove them with:
.replacingOccurrences(of: "\\u{+}", with: "", options: .regularExpression, range: nil)
but it didn't work.
How to remove any special characters in a string? Example: , or in string with Swift 3.
I try to remove them with:
.replacingOccurrences(of: "\\u{+}", with: "", options: .regularExpression, range: nil)
but it didn't work.
Working in Swift 4.1
import Foundation
extension String {
var withoutSpecialCharacters: String {
return self.components(separatedBy: CharacterSet.symbols).joined(separator: "")
}
}