>>I need an expression that essentially strips away the leading zeros and allows a comparison to another value. So if the user enters "2" we would filter by/select all records where the first non-zero character would be "2", getting (with EXACT OFF)......
>>
>>"0002567890"
>>"0000027890"
>>"00002678-1"
>>"0000000002"
>>etc.
>
>Two options: either remove the zeros from the field values on the records (most time consuming) or add the zero's to the user's input (least time consuming). In VFP 9 you can use the LTRIM function to remove leading zero's. But I don't think that option was available in VFP 8. Given that I would recommend adding the zeros to the user expression:
>
>
>lcUserEnteredText = "989"
>
>SELECT mytable
>LOCATE FOR myfield = PADL(lcUserEnteredText,10,"0")
>IF FOUND()
>ELSE
>ENDIF
>
Thanks for taking the time to respond.
I probably didn't express this clearly enough in my original post, but I need an expression that can be used as part of a SELECT WHERE or SET FILTER TO command that would result in ALL the above values being TRUE.
Padding the user input with zeros doesn't work because each record needs a different number of zeros. So I need a way to remove the leading zeros (a VFP 8 equivalent to the VFP 9 LTRIM function)