Skip to content

Instantly share code, notes, and snippets.

@shmidt
Created June 11, 2018 23:41
Show Gist options
  • Save shmidt/9e59d90fc79c6baadce3e3a881c30e6d to your computer and use it in GitHub Desktop.
Save shmidt/9e59d90fc79c6baadce3e3a881c30e6d to your computer and use it in GitHub Desktop.
Extract array of unsigned ints from string
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