how to do this type of search
Phil Davis
revdev at pdslabs.net
Mon Apr 9 21:05:36 EDT 2012
Here is one simple way, assuming you have control over the word list:
-- one-time prep - optimize list for searching
local sMyWordList
put url ("file:" & tPathToMyWords) into sMyWordList
put tab before sMyWordList
replace CR with (tab & CR & tab) in sMyWordList
replace slash with (tab & slash & tab) in sMyWordList
put tab after sMyWordList
-- at search time
set the wholeMatches to true -- not really required since we're including
delimiters in the search string
put lineOffset(tab & tWord & tab, sMyWordList) into tWordLineNumber
Phil Davis
On 4/9/12 5:40 PM, John Dixon wrote:
>
> The 'lineOffset' function will be your friend here...
>
> Dixie
>
>> A straightforward question, I think.
>>
>> I have a list of 5 tab-delimited items per line. Each item can be
>> either a single word or a group of words separated by a "/".
>>
>> Example:
>>
>> abide abode/abided abode/abided/abidden abides abiding
>> alight alit/alighted alit/alighted alights alighting
>> arise arose arisen arises arising
>> awake awoke awoken awakes awaking
>> be was/were been is being
>>
>> What I want my script to do is find which line contains an exact match
>> to a given item.
>>
>> For example:
>>
>> -- "is", on line 5
>> -- "alighted", on line 2
>>
>> All I can think of is to use brute force and go thru the list item by item.
>>
>> Maybe with "wholematches" or such, there's some faster way?
>>
>> Thank you.
>> --
>> Nicolas Cueto
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
--
Phil Davis
PDS Labs
Professional Software Development
http://pdslabs.net
More information about the use-livecode
mailing list