Skip to content

Instantly share code, notes, and snippets.

@onmyway133
Created July 5, 2018 11:41
Show Gist options
  • Save onmyway133/e6efaf6bc7c4c82090e97d1a76666d6e to your computer and use it in GitHub Desktop.
Save onmyway133/e6efaf6bc7c4c82090e97d1a76666d6e to your computer and use it in GitHub Desktop.
public func validate(expression: String) -> String {
let set = Set("0123456789()+-*/")
return expression
.replacingOccurrences(of: "/n", with: "")
.filter({ set.contains($0) })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment