Comparing strings in DataWindow expressions
When you compare strings, the comparison is case-sensitive.
Leading blanks are significant, but trailing blanks are not.
Case-sensitivity
examples
Assume City1 is “Austin” and City2 is “AUSTIN”. Then:
|
1 |
City1=City2 |
returns false.
To compare strings regardless of case, use the Upper or
Lower function. For example:
|
1 |
Upper(City1)=Upper(City2) |
returns true.
For information about these functions, see Using DataWindow expression
functions.
Blanks examples
Assume City1 is “Austin” and City2 is ” Austin “. Then the
expression:
|
1 |
City1=City2 |
returns false. PowerBuilder removes the trailing blank before
making the comparison, but it does not remove the leading
blank.
To prevent leading blanks from affecting a comparison, remove
them with one of the trim functions: Trim or LeftTrim.
For example:
|
1 |
Trim(City1)=Trim(City2) |
returns true.
To compare strings when trailing blanks are significant, use an
expression such as the following to ensure that any trailing blanks
are included in the comparison:
|
1 |
City1 + ">" = City2 + ">" |
For information about these functions, see Using DataWindow expression
functions.