Created
July 5, 2018 11:41
-
-
Save onmyway133/e6efaf6bc7c4c82090e97d1a76666d6e to your computer and use it in GitHub Desktop.
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
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