Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

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.

Swift 3 solution based on Ramis' 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.

Swift 3 solution based on Ramis' 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.

added 47 characters in body
Source Link
SoftDesigner
  • 5.9k
  • 3
  • 61
  • 53

Swift 3 solution based on Ramis' 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.

Swift 3 solution based on Ramis' answer:

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.

Swift 3 solution based on Ramis' 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.

Source Link
SoftDesigner
  • 5.9k
  • 3
  • 61
  • 53

Swift 3 solution based on Ramis' answer:

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.