The StrComp function compares two strings to see if they are
the same. You can have the comparison be sensitive, or not, to the case
(upper versus lower) of the characters in the two strings. The default
is to be case sensitive (binary comparison).
If the strings are the same, the output is zero. If the strings are
different, the output will be a 1 or -1 depending on the order of the
strings.
Comparison Constants
CONSTANT | VALUE | DESCRIPTION |
---|---|---|
VBBinaryCompare | 0 | Binary comparison (case sensitive) |
VBTextCompare | 1 | Text Comparison (case insensitive) |
<% =StrComp("Mountains of the Moon", "Mountains of the Moon") %>
0
<% =StrComp("Mountains of the Moon", "Red sails at sunset") %>
-1
<% =StrComp("Mountains of the Moon", "mountains of the moon", 0) %>
-1
<% =StrComp("Mountains of the Moon", "mountains of the moon", 1) %>
0
<% =StrComp("RED", "red", VBTextCompare) %>
0