How can I calculate the length of a text?

We have a length property:

set theText to "blah"

theText's length --> 4

For intensive calculations, you may use the command count, which is faster:

count theText --> 4

Some times, you may wish calculate the length of a very long text (eg, 479MB), and you won’t hold such amount of text in a variable, but in an external text file. You can choose your favorite and reliable *nix tool, or just:

set longFile to alias "path:to:longFile.txt"

get eof of longFile --> long number