Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Padded strings
Message
From
04/01/2002 11:02:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/01/2002 10:59:27
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00600660
Message ID:
00600769
Views:
33
Not the right but shorter side :)
? 'test' = 'test '
Cetin

>I get .F., .T., for the first two comparisons.
>
>I wasn't aware of the padding with spaces, and thought SET EXACT ON would NOT do this. Interesting.
>
>Wouldn't it be more accurate to say "the string on the right side is padded with spaces, if it is shorter than the string on the left side"? It seams that the string on the left side is not padded.
>
>Hilmar.
>
>
>>This is a common misconception. SET EXACT ON causes the shorter string to be padded with spaces to equal the longer string before they are compared. == is the opnly operator that will actually test for exact equality. That is why I strongly recommend that set exact is never set to ON.
>>
>>
>>lcVar1 = "John"
>>lcvar2 = "John    "
>>
>>SET EXACT OFF
>>? lcvar1 = lcVar2 && True
>>? lcvar2 = lcVar1 && False
>>
>>SET EXACT ON
>>? lcvar1 = lcVar2 && True
>>? lcvar2 = lcVar1 && True
>>
>>* SET EXACT anyway you want
>>? lcvar1 == lcVar2 && False
>>? lcvar2 == lcVar1 && False
>>
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform