powershell - How to insert 0 in a string -
this array :
eth1 eth12 eth5 eth11 when string contains number between 1 , 9 want add 0 before, obtain array :
eth01 eth12 eth05 eth11 how can achieve this? don't know how modify string :/
thanks
like this:
$if = 'eth1', 'eth12', 'eth5', 'eth11' $if -replace '(\d+)(\d)$', '${1}0$2'
Comments
Post a Comment