function to calculate string length...

Frank Leahy frank at backtalk.com
Sun Dec 26 14:07:58 EST 2004


If you have strings that are much longer than the field size, then 
using a binary algorithm might be faster.  Check the string length, if 
too big, then check the length of 1/2 the string, if too small, then 
check the length of 3/4 of the string, and so on until you get within a 
character or two.  You could also take the width of a medium character, 
such as "n", and use that to get you to within a couple of chars of the 
correct length.

-- Frank

Web Photos Pro: Software for Photo Bloggers and Other Photo Power Users
See us on the web at http://www.webphotospro.com/

On Dec 26, 2004, at 5:00 PM, use-revolution-request at lists.runrev.com 
wrote:

> From: Chipp Walters <chipp at chipp.com>
> Subject: Re: function to calculate string length...
> To: chipp at chipp.com,	How to use Revolution
> 	<use-revolution at lists.runrev.com>
> Message-ID: <41CEACE2.9030101 at chipp.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Well, I cobbled this together from some of the archives...
> Anyone see an obvious place to optimize?



More information about the use-livecode mailing list