Strange Syntax

Hi, while I was watching a vido around formatting and enums, I saw a piece of code like this which I typed in ISE and works fine

$Enum = [] 
foreach ($e in [system.enum]::GetValues($enum)) {
"{0,9} {1,9} {2,4} {3,10}" -f $e.tostring("g"),$e.tostring("f") , $e.tostring("d"), $e.tostring("x")

what those “{0,9} {1,9} {2,4} {3,10}” mean?, is it populating arrays? if yes can you please let me know what does it mean {0,9} {1,9}…

Running this piece of code, executes correctly and produces the following output

Monday Monday 0 00000000
Tuesday Tuesday 1 00000001
Wednesday Wednesday 2 00000002
Thursday Thursday 3 00000003
Friday Friday 4 00000004
Saturday Saturday 5 00000005

This is the code used by the format operator for alignement.

Official documentation is here:

And here

And beside of the official documentation you can find some blog posts from Ed Wilson about the basics:

I used to use this site for a quick lookup …

So many thanks, last one is very short and explains very well

If you’ve ever seen things like writeline in C#, it uses the same codes.

[quote quote=135573]I used to use this site for a quick lookup …

Woao Olaf! You found a good one on ss64…

I ended up blocking this site from appearing in my Google results
because every time I clicked on a link from this site it appeared to just be a copy/paste of the content of the Microsoft Technet.
Like if the guy just wants to drain visitors from the Technet to his own site but by providing the exact same content…

Nice finding!