len of field

Lynch, Jonathan bnz2 at cdc.gov
Thu Aug 25 11:29:36 EDT 2005


There is a danger to this method:

repeat until the number of chars of tVar = 14
   put space after tVar
end repeat


if tVar happens to be 15 or greater, it will repeat forever. Perhaps use tVar >= 14 ?

Not that speed is an issue with this example, but with using method it requires checking the number of characters in tVar for every pass.

-----Original Message-----
From: use-revolution-bounces at lists.runrev.com [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Eric Chatonet
Sent: Thursday, August 25, 2005 11:26 AM
To: How to use Revolution
Subject: Re: len of field

Hi Paul,

repeat until the number of chars of tVar = 14
   put space after tVar
end repeat

or by building a function you can use elsewhere with any number of  
chars:

put Extent(tVar,14) into fld "MyField"

function Extent pString,pNumOfChars
   repeat until the number of chars of pString = pNumOfChars
     put space after pString
   end repeat
   return pString
end Extent

The last method is better: always think you want be able to reuse the  
code you write :-)

Le 25 août 05 à 17:11, Paul Salyers a écrit :

> I need to find out how to add spaces to a field length if the  
> number of characters are less than 14 to equal 14 charters.
>
> I'm using this:
>
> if the number of char  of tVar < 14 then (I need to add spaces to  
> equal 14 char)

Best Regards from Paris,

Eric Chatonet.
----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list