>
>lx = "Zip Code"
>ly = "Zip"
>at(ly,lx)
>
>returns 0 instead of 1
> ...
I tried this both with Visual FoxPro 6 and Visual FoxPro 9, and it works as expected, returning 1. I assume you add a question mark to the left of at(ly,lx) - I added it.
Additional considerations:
at() is case-sensitive. You can use atc() instead, if you want to find text in any case.
You may want to issue the command SET STEP ON right before you use the at() command, to check whether the variables really have the expected values.
Also watch out for invisible characters, like spaces. Chec, in the debugger, whether len(ly) (in the example) corresponds to what you would expect from the visible part.
I believe you didn't mention the version of Visual FoxPro, nor the service-pack you are using (if any). It is possible that some versions of Visual FoxPro have a flaw; but I consider this possibility remote in this case; at least, I didn't hear of version-specific problems for this particular command.
HTH,
Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)