Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Case statement not working right
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00643364
Message ID:
00643373
Views:
9
>I have a case statement that is not working right. My variable u = "CLERICAL II" and my variable hu = "CLERICAL I". The problem is that the case statement doesn't recognize the the 2 variables as different. What I'm I doing wrong?
>

That's the way foxpro compares string with '=' operator when SET EXACT is OFF. The string on the left is compared to the lenght of the string on the right only. So
? 'abc' = 'a'    && .T.
"CLERICAL II" = "CLERICAL I"     && .T.
"CLERICAL II" = "CLERICAL I "     && .F.
You can either use '==' operator or pad the shorter string with spaces to the lenght of the other one.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform