Much clearer now. Thanks Paul! I will continue to stick with not equal to a space in my code to test empty fields... I already use empty() whenever I am dealing with variables... But I really appreciate your opinions on this. I wish I had a local fox user group, I could just dicuss this kind of stuff there.
Oh well, thanks again!
>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
--Todd Sherman
-Wake Up! Smell the Coffee!