Last active
November 22, 2017 15:55
-
-
Save Tulakshana/9963a91d523c843e33525f14431efb0c to your computer and use it in GitHub Desktop.
This String extension contains a convenient method to replace characters in a CharacterSet with a given String.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func stringByReplacing(charSet: CharacterSet, with string: String) -> String { | |
let components = self.components(separatedBy: charSet) | |
return components.joined(separator: string) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment