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
| /* | |
| Regex that checks if a number is prime in Swift 2. | |
| From blog post "Demystifying The Regular Expression That Checks If A Number Is Prime" | |
| at https://iluxonchik.github.io/regular-expression-check-if-number-is-prime/ | |
| Submitted by Russel: https://disqus.com/by/disqus_527bF1C8Ck/ | |
| */ | |
| func isPrime(n: Int) -> Bool { | |
| do { | |
| return try NSRegularExpression( |
OlderNewer