trichview.com

trichview.support




Re: Word Count Example?


Return to index


Author

Message

Sergey Tkachenko

Posted: 01/10/2004 12:17:30


You can use a class from

http://www.trichview.com/resources/spell/rvspell.zip.

You need a unit RVWordEnum.pas from there (other files are specific for some

spell

checkers).


Create a class


TWordCounter = class(TRVWordEnumerator)

private

    FCounter: Integer;

protected

    function ProcessWord: Boolean; override;

public

   function GetWordCount(rve: TCustomRichViewEdit): Integer;

end;


function TWordCounter.ProcessWord: Boolean;

begin

  inc(FCounter);

  Result := True;

end;


function TWordCounter.GetWordCount(rve: TCustomRichViewEdit): Integer;

begin

  FCounter := 0;

  Run(rve, rvesFromStart);

  Result := FCounter;

end;


(this function treats word written with two different fonts as two words)





Powered by ABC Amber Outlook Express Converter