Skip to content

Add function to return an array of the digits of an integer #36

@delphidabbler

Description

@delphidabbler

Name the function, DigitsOf.

The function should return a byte array containing the digits of a given integer, with the most significant digit being the first element of the array and the least significant digit being the last element.

For negative integers, only the digits are to be returned. The sign of the number will be discarded.

The function should work for different bases. Returned digits are in decimal, so the digits value of 15 in hex will be [15], while the digits of the same value in decimal will be [1,5].

Zero will be treated as a special case: [0] will be returned rather than an empty array.

Metadata

Metadata

Assignees

Labels

duplicateThis issue or pull request already exists

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions