Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF() error
Message
From
18/06/1999 21:51:39
 
 
To
18/06/1999 08:08:57
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00230164
Message ID:
00231685
Views:
20
Why do you try to do something simple in a complicated way? :) As I said, EMPTY returns true even for strings that contain only spaces (so, not necessarily '') and this makes it equivalent to len(alltrim(cVar))=0 (or alltrim(cVar)==''). Ie, it makes the call to alltrim useless. Besides, with EMPTY(), the code is more clear, IMHO. I usually don't trade readability (clarity) on performance... unless really ncessary.

Now, for your specific question, a field can never be == '' because a field cannot have a length of zero. If you're thinking about Rushmore here, it's good to know that index keys have fixed length in VFP (even if the index expression may return char strings of different length). So, this is another reason against such a test. And this also tells us that all index expressions must return a fixed length result. So, no ALLTRIM(), TRIM(), etc in index expressions.

Vlad


>How about !field > '' ? That should be ok, or !field == '' right?
>
>Not trying to be a bore, just want to write fast code with few indexes...
>
>>It is not the same. field # '' will work only if SET EXACT is OFF. EMPTY returns .t. for character strings made only of spaces, too.
>>
>>Vlad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform