Swift 3 solution based on Ramis' answerRamis' answer:
extension String { func withReplacedCharacters(_ characters: String, by separator: String) -> String { let characterSet = CharacterSet(charactersIn: characters) return components(separatedBy: characterSet).joined(separator: separator) } } Tried to come up with an appropriate function name according to Swift 3 naming convention.