Discussion:
wrong result ?
(too old to reply)
Artur Sanfins
2008-11-10 14:13:56 UTC
Permalink
Is it possible ? What is wrong ?

xp=spac(6)
? xp=spac(6)
--> true
xp=' test'
? xp=spac(6)
--> true <<<<< WHY ????
? xp==spac(6)
--> false <<<<< it's ok !



dBASE PLUS 2.61 b2059 (03/28/2007-EN070328)

Default drive: C:
Current work area: 1
Printer/Device:
Language Driver: DBWINUS0 ('ascii' ANSI)
Character Set: WIN1252
DbType: DBASE
Margin: 0
Decimals: 4
Memowidth: 50
Typeahead: 49
Odometer: 100
Refresh: 0
Reprocess: 0

ALTERNATE - OFF CURRENCY - LEFT EXCLUSIVE - OFF LOCK - ON
AUTONULLFIE - OFF CURSOR - ON FEED - ON NEAR -
OFF
AUTOSAVE - ON DBCSSTR - ON FIELDS - OFF PRINTER -
OFF
BELL - ON DELETED - ON FULLPATH - ON SAFETY -
OFF
CARRY - OFF DELIMITERS - OFF HEADINGS - ON SPACE - ON
CATALOG - OFF DESIGN - ON HELP - ON STEP -
OFF
CENTURY - OFF DEVELOPMENT - ON LD19AS13 - OFF TALK -
OFF
CONFIRM - ON ECHO - OFF LDAUTOCHANG - OFF TITLE -
OFF
CONSOLE - ON ENCRYPTION - ON LDCHECK - OFF UNIQUE -
OFF
COVERAGE - OFF ESCAPE - OFF LDCONVERT - ON
CUAENTER - OFF EXACT - OFF LDNOCHANGE - OFF
Mervyn Bick
2008-11-10 14:43:45 UTC
Permalink
On Mon, 10 Nov 2008 16:13:56 +0200, Artur Sanfins
Post by Artur Sanfins
Is it possible ? What is wrong ?
xp=spac(6)
? xp=spac(6)
--> true
xp=' test'
? xp=spac(6)
--> true <<<<< WHY ????
? xp==spac(6)
--> false <<<<< it's ok !
I copied and pasted the above into a .prg file and on my system, which is
dBase 2.6.0.1, I get true, false, false. The result of the second test
would, however, be true if it was ? xp = space(1) as, with EXACT off, "="
is the equivalent of "begins with" when comparing strings.


Mervyn
Artur Sanfins
2008-11-10 16:01:04 UTC
Permalink
In the last week I was changed my computer and reinstall dbase.
The problem are not solved after change parameters. Exact off or true not
afect the basic result.
I put old intalation of my old computer over new intalation and the problem
are solved.
I Don't know the cause of mal function.
tanks
Artur Sanfins
Post by Mervyn Bick
On Mon, 10 Nov 2008 16:13:56 +0200, Artur Sanfins
Post by Artur Sanfins
Is it possible ? What is wrong ?
xp=spac(6)
? xp=spac(6)
--> true
xp=' test'
? xp=spac(6)
--> true <<<<< WHY ????
? xp==spac(6)
--> false <<<<< it's ok !
I copied and pasted the above into a .prg file and on my system, which is
dBase 2.6.0.1, I get true, false, false. The result of the second test
would, however, be true if it was ? xp = space(1) as, with EXACT off, "="
is the equivalent of "begins with" when comparing strings.
Mervyn
Geoff Wass [dBVIPS]
2008-11-11 05:28:35 UTC
Permalink
In article <i$***@news-server>, ***@tcimix.com
says...
Post by Artur Sanfins
Is it possible ? What is wrong ?
xp=spac(6)
? xp=spac(6)
--> true
xp=' test'
? xp=spac(6)
--> true <<<<< WHY ????
? xp==spac(6)
--> false <<<<< it's ok !
dBASE PLUS 2.61 b2059 (03/28/2007-EN070328)
Current work area: 1
Language Driver: DBWINUS0 ('ascii' ANSI)
Character Set: WIN1252
DbType: DBASE
Margin: 0
Decimals: 4
Memowidth: 50
Typeahead: 49
Odometer: 100
Refresh: 0
Reprocess: 0
ALTERNATE - OFF CURRENCY - LEFT EXCLUSIVE - OFF LOCK - ON
AUTONULLFIE - OFF CURSOR - ON FEED - ON NEAR -
OFF
AUTOSAVE - ON DBCSSTR - ON FIELDS - OFF PRINTER -
OFF
BELL - ON DELETED - ON FULLPATH - ON SAFETY -
OFF
CARRY - OFF DELIMITERS - OFF HEADINGS - ON SPACE - ON
CATALOG - OFF DESIGN - ON HELP - ON STEP -
OFF
CENTURY - OFF DEVELOPMENT - ON LD19AS13 - OFF TALK -
OFF
CONFIRM - ON ECHO - OFF LDAUTOCHANG - OFF TITLE -
OFF
CONSOLE - ON ENCRYPTION - ON LDCHECK - OFF UNIQUE -
OFF
COVERAGE - OFF ESCAPE - OFF LDCONVERT - ON
CUAENTER - OFF EXACT - OFF LDNOCHANGE - OFF
Artur,

I think it is a factor of your CHARSET. Each character set has slightly
different comparison rules. For most comparison it doesn't matter, but
sometimes it does. When it does, I think others have recommended using
asc().
--
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
.|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Loading...