Created
June 11, 2018 23:41
-
-
Save shmidt/9e59d90fc79c6baadce3e3a881c30e6d to your computer and use it in GitHub Desktop.
Extract array of unsigned ints from string
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
extension String{ | |
func extractDigits() -> [UInt]{ | |
return components(separatedBy: CharacterSet.decimalDigits.inverted).compactMap(UInt.init) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment