DoT_PiTcH Contributor
Joined: 07 Aug 2002 Posts: 85
|
Posted: Mon Jan 09, 2012 10:33 pm Post subject: count (solved) |
|
|
is there a simple way to count how many of each item are in a list.
ex. of list
name1
name1
name1
name2
name3
i want to to outout there are 3 name1
i figured it out, i didnt know i could nest repeats
Code: |
list create,1
list create,2
list create,3
list loadfile, 1, \\192.168.1.3\Star2K3_D\BBSM v2.0\emp.dat
list loadfile, 2, \\192.168.1.3\Star2K3_D\BBSM v2.0\data.dat
%%count1 = @count(1)
%%count2 = @count(2)
%%total = 0
%a = 0
%b = 0
repeat
repeat
list seek, 1, %b
list seek, 2, 0
%%name = @item(1)
if @match(2,@item(1))
%%total = @succ(%%total)
list seek, 2, @index(2)
list delete, 2
end
%a = @succ(%a)
until @equal(%a, %%count1)
list add, 3, %%name@tab()@tab()%%total
%b = @succ(%b)
%%total = 0
%a = 0
until @equal(%b,%%count1)
end
|
|
|