[Gambas-user] Wordcount in a TextEdit
Maximillian Von Kloisterheim
maximvonk at ...626...
Sat Apr 19 11:27:56 CEST 2008
richard terry wrote:
> Max, did you try just reading it out as plain text, doing something like
> stripping out all ascii 32's and then counting - this would fail if things
> like word , but overall should be ok.
>
> Regards
>
> Richard
>
Hi Richard, yes, that's what I did, and it does work, but it doesn't
take into consideration double spaces, words with numbers in them and
numbers themselves, to mention but a few.
The count doesn't have to be deadly accurate, but it needs to be close.
Iv noticed a whole lot of difference between different programs and the
way they count their words, so I don't need to be 100%, just as long as
I know the criteria.
As it is I'm making do with the bits of code that Ron posted, but I'm
also looking into the possibility of counting words as you type (Just
like the spelling), and I'm seriously thinking of making the time to
create a new editor control that has such functionality built in.
There is also the possibility of SHELLing out to AWK to get the job
done, but just like the spelling, while this may be accurate, its not
easy to get it to work on a per-word basis as you type.
Regards
Max
More information about the User
mailing list