Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inlist() comparison question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00393021
Message ID:
00393029
Vues:
18
I would say it would be most efficient to set exact outside of your loop if possible.

Set Exact ON
scan MyData
if instr(etc..
EndScan
Set Exact OFF

Depending on what your doing, you may be able to write this as a method so that you only have to write it once and not worry that exact will be left on.

>Thanks guys for the response.
>
>My application defaults to set exact off. This routine that does the comparison can be called from many places in my application. I was wondering your opinions on whether it would be more efficient to do a set exact on do my comparison with inlist() and then set it back off....or if I should use the $ command? Keeping in mind that this routine can be called millions of times
>
>Thank you,
>Paul
>
>>Hi Paul,
>>
>>SET EXACT ON should do the trick for you.
>>
>>>I have noticed that inlist works as if we were doing a compare with one equal sign. IOW, it only does the compare for the length of the expressions we are checking.
>>>
>>>cTemp = "ford"
>>>inlist(upper(cTemp),"THE","AND","ARE","FOR") returns .t.
>>>
>>>I would like to use the inlist function because I think I read that it is very efficient, but I only want it to return .t. if the exact match is found.
>>>
>>>Is my only option to do something like
>>>
>>>upper(cTemp) $ "THE|AND|ARE|FOR"
>>>
>>>I see that this works but I have a routine that can run this comparison a few million times so performance is a huge concern or consideratioin.
>>>
>>>Thanks in Advance,
>>>Paul
kenweber
GCom2 Solutions
Microsoft Certified Professional

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform