The Daily Click ::. Forums ::. Klik Coding Help ::. Counting number of instances of a certain string in a list object?
 

Post Reply  Post Oekaki 
 

Posted By Message

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
2nd May, 2010 at 04:45:08 -

Just wondering how you would go about counting the number of instances of a string in a list box. This may be an overly retarded question, but its late and I hardly get sleep so my brain isn't functioning atm.

For example if the list reads

dog
cat
elephant
dog
dog
squirrel
cat
whale
frog
dog

If you wanted to count the number of instances of "dog" the output would be 4.



Edited by GamesterXIII

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
2nd May, 2010 at 08:16:34 -

I made you an example:

http://mfa.aquadasoft.com/view/1272784584-Count_List_-_Assault_Andy

I think it's relatively straightforward, but ask if you have any questions.
Note that the list is 0-based, not 1-based.

Edited by an Administrator

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
2nd May, 2010 at 17:43:28 -

Ahh I actually figured it out last night.

Thanks though!

I'll check out your example when I get time anyways.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click