if the output:
Range [1,10]
is: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
how can I get:
{001, 002, 003, 004, 005, 006, 007, 008, 009, 010} ?
with 3, or other, exact number of digits?
tnk's
Dear @Mutatis Mutandis you do not need to format code as bold font type. There is a proper formatting for code as you can see in many posts on this forum. Please learn about proper posting here: https://wolfr.am/READ-1ST
If output with Strings is okay, then you can also write-
IntegerString[#, 10, 3] & /@ Range[1, 100]
If you mean selectively padding the 1 or 2 digit numbers with leading zeroes, then you can rewrite [what Nasser has suggested]-
Range[1, 105] /.x_ /; IntegerLength[x] < 3 ->AccountingForm[x, 2, NumberPadding -> {"0", ""}]
It works for numbers 1 or 2 digits, but the reason why I want to get the output with 3-digit is because the output already contains a 3-digit numbers, with your formula the 3-digit numbers become 4-digit
there is a way to map placeholders, such ###, with my numbers 1, 2 or 3 digits, and replace the empty positions with 0?
one way might be
r = Range[1, 10]; AccountingForm[r, 2, NumberPadding -> {"0", ""}]