Skip to content

Instantly share code, notes, and snippets.

@rglos
Created December 20, 2017 22:35
Show Gist options
  • Save rglos/987d5e8ba0fa561cab53c3a5e6c30603 to your computer and use it in GitHub Desktop.
Save rglos/987d5e8ba0fa561cab53c3a5e6c30603 to your computer and use it in GitHub Desktop.
# To return a result string in which absent digits or leading zeroes are replaced by spaces, use
# the composite formatting feature and specify a field width
# https://docs.microsoft.com/en-us/dotnet/standard/base-types/composite-formatting
# specify 3 spaces
Write-Host ("{0,3:N0} 2345" -f 1)
# Output:
# 1 2345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment