Powershell: tally method in array

Created on 1 Jan 2020  路  1Comment  路  Source: PowerShell/PowerShell

create method that counts all the elements in an array a and returns a hash with their counts.

$array = @('abc','ff','abc','abc','ff','r')
$array.tally()
abc ff r
3   2  1
Issue-Enhancement

Most helpful comment

You can use Group-Object cmdlet.

>All comments

You can use Group-Object cmdlet.

Was this page helpful?
0 / 5 - 0 ratings