New chunks
Peter M. Brigham
pmbrig at gmail.com
Sat Mar 15 09:39:44 EDT 2014
On Mar 13, 2014, at 10:17 AM, J. Landman Gay wrote:
> Sure, that's what I'd need to do, convert each instance to items. I was bemoaning the sheer number of times it would have been necessary in just one night's work. It does point out the necessity for me to have a global switch of some sort.
>
> Think of all the swapping you'd have to do within a single repeat loop just to pull out chunks composed of different types of characters. A date followed by a currency followed by a quoted string for example.
>
> On March 13, 2014 6:58:27 AM CDT, Alan Stenhouse <alanstenhouse at hotmail.com> wrote:
>> Wouldn't it be simple to
>>
>> set the itemDel to tab
>> put item 1 of line x of fld y into tDate
>>
>>
>> Granted, slightly more work, but since itemDel changes are limited to
>> only the local handler, it's not too big a deal, is it?
>>
>> Or am I missing something else?
I use the following:
get getItem(line x of fld y,1,tab)
function getItem tList,tIndex,tDelim
-- returns item # tIndex of tList, given itemdelimiter = tDelim
-- could just "get item tIndex of tList" in the calling handler but
-- then have to set and restore the itemDelimiter, so this is less hassle
-- defaults to tDelim = comma
if tDelim = empty then put comma into tDelim
set the itemdelimiter to tDelim
return item tIndex of tList
end getItem
Very handy for pulling strings out of containers.
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
More information about the use-livecode
mailing list