Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
2.6 Problem with 121-1 being the same as 121-10
Message
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00653009
Message ID:
00653797
Views:
18
>Good morning all...
>
>My code prints labels based on the batch number of a file. The batch number in a char and set up 121-NN where NN increments 1 - 99. (121 is the Julian day) However, if I put trim(batch) = '121-10' it gives me all the files with a batch number of '121-1'.
>
>How can I get around this?
>
>Thanks again,
>Sunshine

Aside from what everyone else has replied with,
the reason this is probably happening is confusin over the = operator
in foxpro
? '121-10' = '121-1'  -> .T.
? '121-1' = '121-10'  -> .F.
This is because = (when working with strings) means 'begins with'
whereas == is a 'same as' operator.

padding the strings out with spaces (like sergey reccomends) is a good way to get around it as
* Note the space between -1 and '
? '121-10' = '121-1 '  -> .F.
Anyway you got plenty of slutions here, just though Id clear up why it happens :)
Previous
Reply
Map
View

Click here to load this message in the networking platform