PowerShell sort array

Question:

My array is spits out this.

Any short/simple code to fix it to:

Answer:

You can sort by expression, take everything after the first letter and cast it to integer:

You can also make the solution more generic by removing any non-digit characters:

Source:

PowerShell sort array by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply