firstDigit

returns the first decimal digit of the number

uint
firstDigit
(
T
)
(
T n
)
if (
is(T == BigInt) ||
isUnsigned!T
)

Examples

assert(firstDigit(BigInt("8234567890123456789012345678901234567890123")) == 8);
assert(firstDigit(0U) == 0);
assert(firstDigit(7U) == 7);
assert(firstDigit(9999UL) == 9);
assert(firstDigit(uint.max) == 4);
assert(firstDigit(ulong.max) == 1);

Meta