I have several strings and try to remove the leading zeros for them. I know I can use TrimStart()
but it's wrong if all numbers are zero.
$Test = "00000.22"
$Test = $Test.trimstart('0')
The result is .22 and what I expect is 0.22. How can I achieve it? Thank you.
You can use type conversion to decimal
$Test = "00000.22"
[decimal]$Test