tabstops fld

yves COPPE yvescoppe at skynet.be
Wed Jan 16 15:44:01 CST 2002


>Hello,
>
>I' have a fld with columns (tabstop property).
>I'd like to pick the text of one column.
>There is a XFCN from Rinaldi
>
>put extractitems(fld "myFld","2",tab) into txtofColumn2
>
>Is it possible to write a script that goes even fast ?
>Is there a syntax in transcript ?
>
>Thanks


So, with the help of a few emails to the user.list and good answers 
from the readers, here is the final script to extract differents 
columns of a tab fld :

function extractItem pFieldName, pItemNumber,delim
   local tempLine, tempItem,vListofItems,vListToReturn
    repeat for each line tempLine in pFieldName
      put "" into vListofItems
      repeat for each item tempItem in pItemNumber
       set itemDelimiter to delim
       put item tempItem of tempLine &delim after vListofItems
       set itemDelimiter to ","
     end repeat
     delete last char of vListofItems
     put vListofItems& return after vListToReturn
   end repeat
   set itemDelimiter to ","
   delete last char of vListToReturn
   return vListToReturn
end extractItem


Sample :

put extractitem(fld 1,"1,2,6",TAB) into anyVar
it extracts from fld 1 a tab-tab-return variable (=anyvar) with only 
the columns 1,2,6
and it works fine and fast
For a fld of 50 lines with 10 columns, I reach on a PowerMac G4 800 
MHZ the same speed in Revolution (counted in ticks) as with the 
external of Rinaldi in Hypercard.
I haven't tried it yet on an iMac G3 400. I'll try it later and tell you.


Thanks to all who helped meŠ
-- 
Salutations.

Yves COPPE

Email : yvescoppe at skynet.be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20020116/87fa4885/attachment.html>


More information about the use-livecode mailing list