| << D.2.3- Concatenation operators | AppendixD | D.2.5- Logical operators >> |
Comparison operators
The comparison operators are usedfor comparing variables and expressions against other variables, constants orexpressions; they are listed in order of OperatorPrecedence.
One important thing to rememberwhen comparing strings is case sensitivity. You can use the UCase and LCasefunctions to make sure that the strings you compare are the same case; the StrComp function offers another way ofdealing with case sensitivity (see under String Functions).In VB/VBA you have the Option Compare statement,but this is not supported in VBScript. So keep in mind, when using theoperators listed below, that if you compare strings (when both expressions arestrings), a binary comparison is performed on the sequences of characters. Abinary comparison is always case sensitive. If only one of the expressions is astring and the other is numeric, the numeric expression is always less than thestring expression.
The Isoperator is for dealing with objects and Variants.
| = | Name
Description
Syntax | Equal to
Returns true if expression1 is equal to expression2; false otherwise.
Result = expression1 = expression2
|
| <> | Name
Description
Syntax | Not equal to (different from)
Returns true if expression1 is not equal to expression2;
Result = expression1 <> expression2
|
| < | Name
Description
Syntax | Less than
Returns true if expression1 is less than expression2; false otherwise.
Result = expression1 < expression2
|
| > | Name
Description
Syntax | Greater than
Returns true if expression1 is greater than expression2;
Result = expression1 > expression2
|
| <= | Name
Description
Syntax | Less than or equal to
Returns true if expression1 is less than or equal to expression2; false otherwise.
Result = expression1 <= expression2
|
| >= | Name
Description
Syntax | Greater than or equal to
Returns true if expression1 is greater than or equal to expression2; false otherwise.
Result = expression1 >= expression2
|
| Is | Name
Description
Syntax
Note | Compare objects
Returns true if object1 and object2 refers to the same memory location (if they are in fact the same object).
Result = object1 Is object2
Use the Not operator (see under Logical Operators) with
Result = object1 Not Is object2
Use the Nothing keyword with the Is operator to check if an object reference is valid. Returns true if object has
Result = object Is Nothing
Be careful, Nothing is NOT the same as Empty. Nothing references an invalid object reference, whereas Empty is used for any variable, which has been assigned the value of Empty, or has not yet been assigned a value. |
| << D.2.3- Concatenation operators | AppendixD | D.2.5- Logical operators >> |

RSS

