Is there a way to check if a character belongs to a CharacterSet
?
I wanna know what CharacterSet
should I use for character -
. Do I use symbols
?
I've checked this documentation but still no idea. https://developer.apple.com/documentation/foundation/characterset
When removing extra whitespace at the end of a string, we do it like this:
let someString = " "
print("\(11111) - \(someString)".trimmingCharacters(in: .whitespaces))
But what if I just want to remove the -
? Or any special character such as *
?
EDIT: I was looking for a complete set of characters per each CharacterSet
if it's possible.