Having the 2 strings below:
string1 = '00' - 2 consecutive zeroes
string2 = ' 0' - 1 space and 1 zero
The following "if" statement is resulting true when the strings are clearly different:
if string1 = string2 then say "True"
This is standard REXX behavior. When REXX compares 2 numbers with the equal "=" operator leading zeroes and spaces are ignored so "00" will be considered the same as " 0". This behavior applies to any strings that can be converted to numeric values.
To make REXX compare the values of the 2 variables as strings, you should use the "strictly equal" operator "==" instead of the "equal" operator "=". For example:
if string1 == string2 then say "True"
See a list of the REXX operators that includes the "strict" comparison operators:
= EQUAL == STRICTLY EQUAL
> GREATER THAN >> STRICTLY GREATER THAN
< LESS THAN << STRICTLY LESS THAN
>< NOT EQUAL >>= STRICTLY GREATER THAN OR EQUAL TO
>= GREATER THAN OR EQUAL TO <<= STRICTLY LESS THAN OR EQUAL TO
<= LESS THAN OR EQUAL TO