Think of something that you wish Authorware could do but it doesn't?  Let the our good friends at Macromedia know via the wishlist.

Please let us know if you find any of the materials on this site inappropriate or offensive. Please include the url and why the material should be reviewed.

Comments and questions about the site are also welcome. Please no Authorware questions, use the AWARE list.


1031 - How can I count all occurrences of a letter in an external file?

by - Joseph Ganci

I want to count all the occurrences of a particular letter in an external file. How do I do this?

Here you go. This will look for the letter "r" in the file (lower or uppercase)

text := ReadExtFile("c:\\myfile.txt")
count := CharCount(text) - CharCount(Strip("r", LowerCase(text)))

If you really want to do it in one line, Mr. Tom Adams, you'll have to repeat the read function twice, which is overkill:

count := CharCount(ReadExtFile("c:\\myfile.txt")) - CharCount(Strip("r",LowerCase(ReadExtFile("c:\\myfile.txt"))))

That will do it!

There are 0 reviews
Add your review