# padding with preceding zeros [duplicate]

I have a

list1 = {1, 23, 4, 14} (*max entry is 99*)


and want to create from that another

list2 = {01, 23, 04, 14}


preceding zeros if the number is less than 10.

How can I do that?

• NumberForm should work... – Yves Klett Dec 20 '18 at 13:55
• @Yves Klett: can you please show the solution with NumberForm – lio Dec 20 '18 at 14:16

IntegerString[list1, 10, 2]


Note that the resulting list consists of strings and not numbers. But maybe that is sufficient for your application?

• Thank you. Yes, from the numbers I produce strings for labels. – lio Dec 20 '18 at 14:00
• Okay, then it's the way to go! =) You're welcome. – Henrik Schumacher Dec 20 '18 at 14:06