forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


count (solved)

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
DoT_PiTcH
Contributor
Contributor


Joined: 07 Aug 2002
Posts: 85

PostPosted: Mon Jan 09, 2012 10:33 pm    Post subject: count (solved) Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group