Sunday, June 25, 2017

#1 2005-10-28 04:07:36 pm

From: MalasaƱa, Madrid
Registered: 2002-11-20
Posts: 2014

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



Board footer

Powered by FluxBB

[ Generated in 0.035 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)