Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is VFP9 Help on Set Ansi wrong or what?
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01014326
Message ID:
01014366
Views:
21
Hi Jeff,

The Example part of the SET ANSI topic is plainly bad. See my comments and corrections below

>Check out VFP9 (and maybe in previous versions) Help for Set Ansi and you get a section that sez this:
>
>***********************************
>In the following example, when SET ANSI is set to ON, the result is False (.F.) because when padded, 'Tom' becomes 'Tom ', and the strings 'Tom ' and 'Tommy' do not match character for character:
>
> Copy Code
>'Tommy' = 'Tom'


Description itself is correct but "code" isn't a code that can be run.
CREATE CURSOR Dummy (Dummy I)
APPEND BLANK
SET ANSI ON
SELECT 'Tommy' = 'Tom'   AS SringsAreEqual FROM Dummy TO SCREEN
SELECT 'Tom'   = 'Tommy' AS SringsAreEqual FROM Dummy TO SCREEN
>
<i>>The == operator uses this method for comparisons in Visual FoxPro SQL commands.</i>

This line implies that == opearator pads shorter string to the lenth of the longer one but it's not the case. <pre>
SELECT 'Tom'     == 'Tommy' AS SringsAreEqual FROM Dummy TO SCREEN
SELECT 'Tommmy ' == 'Tommy' AS SringsAreEqual FROM Dummy TO SCREEN
SELECT 'Tommmy'  == 'Tommy ' AS SringsAreEqual FROM Dummy TO SCREEN
>
>In the following example, when SET ANSI is set to ON, the result is True (.T.) because the comparison stops after 'Tom':
>
> Copy Code
>'Tommy' = 'Tom'

It's a typo. It should say ', when SET ANSI is set to OFF,'.
CREATE CURSOR Dummy (Dummy I)
APPEND BLANK
SET ANSI ON
SELECT 'Tommy' = 'Tom'   AS SringsAreEqual FROM Dummy TO SCREEN
SELECT 'Tom'   = 'Tommy' AS SringsAreEqual FROM Dummy TO SCREEN
SELECT 'Tom'  == 'Tommy' AS SringsAreEqual FROM Dummy TO SCREEN
>***********************************
>
>Is this, like, really bad documentation or what? Or am I just plain dumb?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform