Zero-pad single digits

Associate
Joined
21 May 2003
Posts
1,365
Right, need a quick reg-ex function to replace any instances of single digits in an array with a zero-padded version.

e.g.
array (2004,9,14)

should become
array (2004,09,14)

How do you keep the existing content and insert a zero before the match rather than replacing it completely?

Ta in advance.
 
Back
Top Bottom