lundi 31 mars 2014

Reverse elements via pipeline


Vote count:

0




Is there a function reverses elements passed via pipeline?


E.g.:



PS C:\> 10, 20, 30 | Reverse
30
20
10


asked 1 min ago


1 Answer



Vote count:

0




Here's one approach:



function Reverse ()
{
$arr = $input | ForEach-Object { $_ }
[array]::Reverse($arr)
return $arr
}


answered 44 secs ago





Aucun commentaire:

Enregistrer un commentaire