Find will only work with sorted list. Use IndexOf if the list is not sorted.

-regards,
Guru Kathiresan
Crossplatform Form Designer for Delphi
http://www.twinforms.com


> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
> Behalf Of Peter Luijer
> Sent: Friday, October 02, 2009 3:52 PM
> To: [email protected]
> Subject: RE: [delphi-en] counting occurances of unique words
> 
> Hi Andries,
> 
> I can imagine something similar to this:
> 
> [CODE]
> Procedure WordFound(AWord : String);
> Var
>   I : Integer;
> Begin
>   If StringList.Find(AWord, I) Then
>     StringList.Objects[I] :=
> TObject(Succ(Integer(StringList.Objects[I])));
> End;
> [/CODE]
> 
> Greetz,
> 
> Peter.
> 
> 
> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:[email protected]]namens
> Andries Bos
> Verzonden: zaterdag 3 oktober 2009 0:31
> Aan: [email protected]
> Onderwerp: Re: [delphi-en] counting occurances of unique words
> 
> 
>   Thanks Rory for your answer
> 
> I already found the TStringlist and the ability to add a second parameter
> (an object), but i mis on how I could use this as a counter? ("Add to add
> a
> new word, and Objects
> (typecast as an Integer") to increment the count of a word that is already
> in
> the list.
> )
> A small sniplet of code could help maybe. It sounds like the easiest
> solution.
> 
> I would expect max about 20 different wordt, but every one could occur
> about
> 5 times.
> 
> regards
> 
> Andries
> 
> 
> 
> ------------------------------------
> 
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: [email protected]! Groups Links
> 
> 
> 

Reply via email to