Re: Win32Lib Feature Request
- Posted by gertie at visionsix.com
Jan 23, 2003
On 22 Jan 2003, at 14:33, C. K. Lester wrote:
>
> Please include this in Win32Lib (if not already!) and tell me where to put
> it in my own copy... I asked nicely! :)
>
> ----
> function matchItem( integer List_ID, sequence matchTerm )
>
> This function would return a sequence of item numbers -OR- the items
> themselves that in whole or part matched the matchTerm. An empty sequence is
> return when no matches are found.
>
> Example:
>
> -- myList = {"IADCDAYW.DOT","OTHER.DOT","IADCFOOT.DOT","IADCTURN.DOT"}
Strtok-v2-1 can find them using various combinations of matchtok, findtok, or
wildntok, matchntok, and retrieve them with gettok,, for instance:
junk = gettok(myList,wildntok(myList,"IADC*",0,""),"")
You can select case-insensitivity for find, get, match, etc, in v2-1 too.
> junk = matchItem( myList, "IADC" )
>
> junk could now equal { "IADCDAYW.DOT","IADCFOOT.DOT","IADCTURN.DOT"}
>
> -or, if returning values only,
>
> junk could equal { 1, 3, 4 }
Yep, matchntok or wildntok will do that. Either case-sensitively, or
insensitively. the difference is that matchntok is like a wildntok using *IADC*,
and you know your match is only at the start of the sequences, so i'd use
IADC* in wildntok. If you break up the subsequences into more dotted form,
strtok gets even more precise in what you can locate.
Kat
|
Not Categorized, Please Help
|
|