Last active
August 29, 2015 14:24
-
-
Save oisdk/3ac0e2e6361de0e174c9 to your computer and use it in GitHub Desktop.
This file contains 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
import Foundation | |
extension String.UnicodeScalarView.Generator { | |
mutating func hasUpper() -> Bool { | |
return next().map { | |
NSCharacterSet | |
.uppercaseLetterCharacterSet() | |
.longCharacterIsMember(UInt32($0)) | |
|| hasUpper() | |
} ?? false | |
} | |
} | |
extension String { | |
func hasUpper() -> Bool { | |
var g = unicodeScalars.generate() | |
return g.hasUpper() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment