Operators

Syntax:

^ Not * / \ Mod + - & < <= > >= = <> Is And Or Xor Eqv Imp

Description:
These operators are available for numbers n1 and n2 or strings s1 and s2. If any value in an expression is Null then the expression's value is Null. The order of operator evaluation is controlled by operator precedence.

Operator Description

- n1 Negate n1.

n1 ^ n2 Raise n1 to the power of n2.

n1 * n2 Multiply n1 by n2.

n1 / n2 Divide n1 by n2.

n1 \ n2 Divide the integer value of n1 by the integer value of n2.

n1 Mod n2 Remainder of the integer value of n1 after dividing by the integer value of n2.

n1 + n2 Add n1 to n2.

s1 + s2 Concatenate s1 with s2.

n1 - n2 Difference of n1 and n2.

s1 & s2 Concatenate s1 with s2.

n1 < n2 Return True if n1 is less than n2.

n1 <= n2 Return True if n1 is less than or equal to n2.

n1 > n2 Return True if n1 is greater than n2.

n1 >= n2 Return True if n1 is greater than or equal to n2.

n1 = n2 Return True if n1 is equal to n2.

n1 <> n2 Return True if n1 is not equal to n2.

s1 < s2 Return True if s1 is less than s2.

s1 <= s2 Return True if s1 is less than or equal to s2.

s1 > s2 Return True if s1 is greater than s2.

s1 >= s2 Return True if s1 is greater than or equal to s2.

s1 = s2 Return True if s1 is equal to s2.

s1 <> s2 Return True if s1 is not equal to s2.

Not n1 Bitwise invert the integer value of n1. Only Not True is False.

n1 And n2 Bitwise and the integer value of n1 with the integer value n2.

n1 Or n2 Bitwise or the integer value of n1 with the integer value n2.

n1 Xor n2 Bitwise exclusive-or the integer value of n1 with the integer value n2.

n1 Eqv n2 Bitwise equivalence the integer value of n1 with the integer value n2 (same as Not (n1 Xor n2)).

n1 Imp n2 Bitwise implicate the integer value of n1 with the integer value n2 (same as (Not n1) Or n2).

Like Operator

Syntax:

str1 Like str2

Group: Operator

Description: Return the True if str1 matches pattern str2. The pattern in str2 is one or more of the special character sequences shown in the following table.

Char(s) Description

? Match any single character.
* Match zero or more characters.
# Match a single digit (0-9).

[charlist] Match any char in the list.

[!charlist] Match any char not in the list.

Example:

Sub Main
Debug.Print "abcdfgcdefg" Like "" ' False
Debug.Print "abcdfgcdefg" Like "a*g" ' True
Debug.Print "abcdfgcdefg" Like "a*cde*g" ' True
Debug.Print "abcdfgcdefg" Like "a*cd*cd*g" ' True
Debug.Print "abcdfgcdefg" Like "a*cd*cd*g" ' True
Debug.Print "00aa" Like "####" ' False
Debug.Print "00aa" Like "????" ' True
Debug.Print "00aa" Like "##??" ' True
Debug.Print "00aa" Like "*##*" ' True
Debug.Print "hk" Like "hk*" ' True
End Sub