From: David Christiansen Subject: Re: How many words ? Date: 20 Jan 2000 00:00:00 GMT Message-ID: <3887546F.9281F366@qqest.com> Content-Transfer-Encoding: 7bit References: <867hve$hip6@bornews.borland.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Qqest Software Systems Mime-Version: 1.0 Newsgroups: borland.public.delphi.objectpascal Alejandro Castro wrote: > Hi > > How can I know, on a easy way, the number of words on a Memo Field ? > > Is there a property for that or a thirdparty component that include it ? > > Thanks > > Alejandro I would try something like this: I believe that you can do a memo field as string to get the entire text, otherwise, you may need to figure out how to do this or modify my function function CountWords (s:string):integer; // untested var InWord:boolean; i:integer; begin InWord := False; result := 0; for i := 1 to Length(s) do begin case s[i] of 'A'..'Z','0'..'9','a'..'z': { everything that could be included (add international characters if needed) } begin if not InWord then inc(result); InWord := True; end else // spaces, punctuation, new lines, ... begin inWord := False; end; end; end; -- A fool must now and then be right by chance.