I've run into this problem before. Here is how I got around it.
x = '1 '
y = ' 1'
test.x = "*":x:"*"
test.y = "*":y:"*"
if test.x = test.y then
do stuff
end else
do other stuff
end
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lindsay Gregory
Sent: Wednesday, May 12, 2004 9:29 PM
To: [EMAIL PROTECTED]
Subject: [U2] SPACE character ignored
Hi
I am sure this has been covered somewhere before but I could not find under
oliver.com or u2ug.org.
Can anyone tell me why: if
X = '1'
Y = '1 ' ;* note the trailing space character
X = Y is true
But if
X = ''
Y = ' '
X = Y is false
So adding a space character to a text string is ignored but adding a space
character to a null is not ignored.
I can understand why X = '' is not equal to Y = ' ' because X is not a text
string but if in the first case - the text string Y has two characters - a
one and a space and the text string X has only one character how can they be
equivalent.
My guess is that by the time they come to be tested for equivalence they
have been converted to numeric values and are being tested for numeric
equivalence.
How can I force them to be tested for TXT equivalence?
Do I have to say:
IF X = Y AND LEN(X) = LEN(Y) THEN true
Except if X = ' 1' and Y = '1 ' then LEN(X) = LEN(Y) ...
It seems that leading or trailing spaces are ignored (but not embedded
spaces) so I have to say
IF LEN(X) = LEN(TRIM(X)) AND LEN(Y) = LEN(TRIM(Y)) AND X = Y THEN true
There has got to be an easier way !!
Lindsay Gregory
Axys (NZ) Ltd
www.axys.co.nz
Ph: +64 9 5200264
Fax +64 9 5200266
Mob +64 21 770 462
-------
u2-users mailing list
[EMAIL PROTECTED] http://www.u2ug.org/listinfo/u2-users
-------
u2-users mailing list
[EMAIL PROTECTED]
http://www.u2ug.org/listinfo/u2-users