Skip to content

Instantly share code, notes, and snippets.

@Banck
Last active November 9, 2017 13:55
Show Gist options
  • Save Banck/0d7289a322553752f8030f64c9468120 to your computer and use it in GitHub Desktop.
Save Banck/0d7289a322553752f8030f64c9468120 to your computer and use it in GitHub Desktop.
func IntToReversedArrayOfInts (_ b:Int?)->(arr:[Int],count:Int){
guard let number = b else { return ([],0)}
let str = String(number)
var digits = str.flatMap{Int(String($0))}
digits = digits.reversed()
return (digits,digits.count)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment