I need to add a zero to the front of a number, but only if that number is less than two characters.
Here is what I have as of now:
Import-Csv C:\WORK\MATCH_TRANSIT_POWERSHELL\done.csv | ForEach-Object { Measure-Object -Character -InputObject $_.DLVRYPNT }
$count = ForEach-Object { Measure-Object -Character -InputObject $_.DLVRYPNT } { Write-Host "count : " $count }
If($count -eq 1)
{
ForEach-Object {"1",’0'}
}
I know I'll need to assign a new variable for the bottom portion, but I'm not entirely sure how to go about it. "$_.DLVRYPNT" is the column in which I'm counting the characters. Not sure if my syntax is correct for adding a zero if the column contains less than 2 characters. Any help with this would be greatly appreciated. This is my first post, hope to contribute myself!