Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to count words in a TRichEdit Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
12-Oct-02
Category
Reporting /Printing
Language
Delphi 2.x
Views
101
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

How to count words in a TRichEdit

Answer:
1   
2   function GetWord: boolean;
3   var
4     s: string; {presume no word > 255 chars}
5     c: char;
6   begin
7     result := false;
8     s := ' ';
9     while not EOF(f) do
10    begin
11      read(f, c);
12      if not (c in ['a'..'z', 'A'..'Z' {,... etc.}]) then
13        break;
14      s := s + c;
15    end;
16    result := (s <> ' ');
17  end;
18  
19  procedure GetWordCount(TextFile: string);
20  begin
21    Count := 0;
22    assignfile(f, TextFile);
23    reset(f);
24    while not EOF(f) do
25      if GetWord then
26        inc(Count);
27    closefile(f);
28  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC