I'm looking for a way to remove dollar signs, commas and periods using a single line of code (I'm able to do it using replacingOccurrences 3x). I found trimmingCharacters(:_) but for some reason it doesn't remove commas and periods (at least not all the time).
This is what I get in Xcode 8.1 playground:
var myString = "$3,000.50"
myString.trimmingCharacters(in: CharacterSet(charactersIn: "$.,")) //"3,000.50"
myString.trimmingCharacters(in: CharacterSet(charactersIn: myString)) //""
Can someone help me understand why this doesn't work? Thanks.