Comparison
- Last UpdatedJan 28, 2025
- 3 minute read
This section explains the syntax of comparison operators that can be used to make Boolean comparison of values resulting from expressions. A Boolean comparison will have the result true or false.
If a comparison operator is prefixed with ! (exclamation mark), the result of the expression will be negated, e.g. the operator == is comparing whether two values are equal, while the operator !== is comparing whether two values are different.
?=== (Ends with)
This operator is used to check whether the value resulting from an expression is identical to, or ends with, a second value.
left-expression ?=== right-expression
|
Arguments |
Description |
|---|---|
|
left-expression |
An arbitrary expression, which resulting value will be compared with the value from right-expression |
|
right-expression |
An arbitrary expression, which resulting value will be compared with the value from left-expression |
Examples:
./@name ?=== ‘MOTOR’
Assuming the value of @name is "MOTOR", or "ELECTRIC MOTOR", the result of the above example will be true.
./@name ?=== ‘PUMP’
Assuming the value of @name is "Pump", or "Centrifugal Pump", the result of the above example will be false (because the letter casing is not the same).
?== (Ends with, ignore letter casing)
This operator is used to check whether the value resulting from an expression is identical to, or ends with, a second value (where the casing of the letters in the values are insignificant).
left-expression ?== right-expression
|
Arguments |
Description |
|---|---|
|
left-expression |
An arbitrary expression, which resulting value will be compared with the value from right-expression |
|
right-expression |
An arbitrary expression, which resulting value will be compared with the value from left-expression |
Examples:
./@name ?== ‘MOTOR’
Assuming the value of @name is "MOTOR", or "Electric Motor", the result of the above example will be true.
=== (Equals)
This operator is used to check whether the value resulting from an expression is identical to a second value.
left-expression === right-expression
|
Arguments |
Description |
|---|---|
|
left-expression |
An arbitrary expression, which resulting value will be compared with the value from right-expression |
|
right-expression |
An arbitrary expression, which resulting value will be compared with the value from left-expression |
Examples:
./@name === ‘MOTOR’
Assuming the value of @name is "MOTOR", the result of the above example will be true.
./@name === ‘PUMP’
Assuming the value of @name is "Pump", the result of the above example will be false (because the letter casing is not the same).
== (Equals, ignore letter casing)
This operator is used to check whether the value resulting from an expression is identical to a second value (where the casing of the letters in the values are insignificant).
left-expression == right-expression
|
Arguments |
Description |
|---|---|
|
left-expression |
An arbitrary expression, which resulting value will be compared with the value from right-expression |
|
right-expression |
An arbitrary expression, which resulting value will be compared with the value from left-expression |
Examples:
./@name == ‘MOTOR’
Assuming the value of @name is "MOTOR", or "Motor", the result of the above example will be true.
./@name !== ‘MOTOR’
Assuming the value of @name is "MOTOR", or "Motor", the result of the above example will be false (because the ! sign is negating the result, i.e. the expression compares whether @name is not equal "MOTOR").
===? (Starts with)
This operator is used to check whether the value resulting from an expression is identical to, or starts with, a second value.
left-expression ===? right-expression
|
Arguments |
Description |
|---|---|
|
left-expression |
An arbitrary expression, which resulting value will be compared with the value from right-expression |
|
right-expression |
An arbitrary expression, which resulting value will be compared with the value from left-expression |
Examples:
./@name ===? ‘MOTOR’
Assuming the value of @name is "MOTOR", or "MOTOR, Electrical", the result of the above example will be true.
./@name ?=== ‘PUMP’
Assuming the value of @name is "Pump", or "Pump, Centrifugal", the result of the above example will be false (because the letter casing is not the same).
==? (Starts with, ignore letter casing)
This operator is used to check whether the value resulting from an expression is identical to, or starts with, a second value (where the casing of the letters in the values are insignificant).
left-expression ==? right-expression
|
Arguments |
Description |
|---|---|
|
left-expression |
An arbitrary expression, which resulting value will be compared with the value from right-expression |
|
right-expression |
An arbitrary expression, which resulting value will be compared with the value from left-expression |
Examples:
|
./@name ==? ‘MOTOR’ |
Assuming the value of @name is "MOTOR", or "Motor, Electric", the result of the above example will be true.
|
./@name !==? ‘MOTOR’ |
Assuming the value of @name is "MOTOR", or "Motor, Electric", the result of the above example will be false (because the ! sign is negating the result, i.e. the expression compares whether @name not starts with "MOTOR").