-
Notifications
You must be signed in to change notification settings - Fork 1
Equals Operator
Martin Danielsson edited this page Dec 17, 2024
·
5 revisions
Checks whether to strings are equal. Comes in two flavors, Equals
and EqualsIgnoreCase
.
What | Type |
---|---|
Syntax | Equals[IgnoreCase](a, b) |
a |
any |
b |
any |
Return type | bool |
Example: Equals($firstName, "Martin")
The Equals
operator (not the EqualsIgnoreCase
) can also be noted infix using the =
operator.
Prefix Notation | Infix Notation |
---|---|
Equals($status, "004") |
$status="004" |
Equals(Length($lastName), 10) |
Length($lastName)=10 |
Equals(LowerCase($city), LowerCase($deliveryCity)) |
LowerCase($city)=LowerCase($deliveryCity) |
The =
can be made to behave as the EqualsIgnoreCase
operator generally by using an operator configuration (see below).
By using the following XML code in the configuration file, the Equals
operator may be generally made behave as the EqualsIgnoreCase
operator; additionally, it can be specified to ignore differences in CR/LF behavior, i.e. return true
if the only difference is in CR+LF vs. LF (Windows vs. Linux):
<OperatorConfigs>
<OperatorConfig name="Equals">ignorecase,ignorecrlf</OperatorConfig>
</OperatorConfigs>
This also applies to the infix =
operator, which is why it may be useful to apply this operator configuration.