dbTalk Databases Forums  

vfp 3 funny

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss vfp 3 funny in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Michael J Davis
 
Posts: n/a

Default vfp 3 funny - 08-28-2003 , 06:34 AM







It's just one of those frustrating things. Can anyone please explain
why, in VPF3.0b, the comparison of two fields (one blank, one completed)
:-

(n_add1)=(add1) returns false, but

trim(n_add1) = trim(add1) returns true

Thanks

Mike
[The reply-to address is valid for 30 days from this posting]
--
Michael J Davis
http://www.trustsof.demon.co.uk
<><
For this is what the Lord has said to me,
"Go and post a Watchman and let
him report what he sees." Isa 21:6
<><

Reply With Quote
  #2  
Old   
Cindy Winegarden
 
Posts: n/a

Default Re: vfp 3 funny - 08-28-2003 , 07:21 AM






Hi Mike,

I've never used VFP3, but I do know that SET EXACT and SET ANSI affect the
way strings are compared, and they go back to FPW.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy.winegarden (AT) mvps (DOT) org, www.cindywinegarden.com

"Michael J Davis" <miked (AT) trustsof (DOT) demon.co.uk> wrote

Quote:
It's just one of those frustrating things. Can anyone please explain
why, in VPF3.0b, the comparison of two fields (one blank, one completed)
:-

(n_add1)=(add1) returns false, but

trim(n_add1) = trim(add1) returns true



Reply With Quote
  #3  
Old   
Josh Assing
 
Posts: n/a

Default Re: vfp 3 funny - 08-28-2003 , 08:54 AM



it's in all vfp versions... it's by design.
when you do the first comparisioin, they are (i'm guessing) equal lengths. The
string comparisions does a character comparison and fails.
when you TRIM() the strings, now one string is empty.
The character by character comparaion stops before it starts becuase one string
is empty.... so it's true.

Swap the two, and it'll be false..

Use == instead if you want to make sure they're exactly teh same.

btw: Everyone generally feels vfp3 was just a "preview" version of vfp5 (not
even a beta... I'd upgrade)

On Thu, 28 Aug 2003 12:34:52 +0100, Michael J Davis <miked (AT) trustsof (DOT) demon.co.uk>
wrote:

Quote:
It's just one of those frustrating things. Can anyone please explain
why, in VPF3.0b, the comparison of two fields (one blank, one completed)
:-

(n_add1)=(add1) returns false, but

trim(n_add1) = trim(add1) returns true

Thanks

Mike
[The reply-to address is valid for 30 days from this posting]


Reply With Quote
  #4  
Old   
Gene Wirchenko
 
Posts: n/a

Default Re: vfp 3 funny - 08-28-2003 , 11:55 AM



Josh Assing <josh (AT) jassing (DOT) com> wrote:

Quote:
it's in all vfp versions... it's by design.
I expect that it is in all xBASE version.

Quote:
when you do the first comparisioin, they are (i'm guessing) equal lengths. The
string comparisions does a character comparison and fails.
when you TRIM() the strings, now one string is empty.
The character by character comparaion stops before it starts becuase one string
is empty.... so it's true.

Swap the two, and it'll be false..

Use == instead if you want to make sure they're exactly teh same.

btw: Everyone generally feels vfp3 was just a "preview" version of vfp5 (not
even a beta... I'd upgrade)
Interesting point, but irrelevant to the string problem
specifically. The string comparison has worked that way all the way
back to dBASE II.

[snip]

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.