Skip to content

Instantly share code, notes, and snippets.

@fredriccliver
Created May 7, 2021 16:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredriccliver/013657f25191896353447b19803be8a8 to your computer and use it in GitHub Desktop.
Save fredriccliver/013657f25191896353447b19803be8a8 to your computer and use it in GitHub Desktop.
import Foundation
extension String {
var withoutPunctuations: String {
return self.components(separatedBy: CharacterSet.punctuationCharacters).joined(separator: "")
}
}
let originalStr:String = "hello, (Nice to- meet 한국 école %&$you all. 123 ! Давай العربية 😀"
print(originalStr)
print(originalStr.withoutPunctuations)
@stormychel
Copy link

Awesome solution!

@fredriccliver
Copy link
Author

@stormychel Thanks for comment! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment