StrCompare
- Last UpdatedOct 29, 2026
- 1 minute read
StrCompare is a built-in function that compares two strings to see if they are identical.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
StrCompare |
String |
Synchronous |
Yes |
Supported |
Supported |
Supported |
Supported |
Supported |
Syntax
StrCompare(strValue1,strValue2)
strValue1
The first string in the comparison.
strValue2
The second string in the comparison.
Return value
This function returns one of the following possible values:
|
Value |
Description |
|---|---|
|
-2 |
At least one of the specified values is not a string. |
|
-1 |
The value of strValue1 is less than the value of strValue2. |
|
0 |
The values of strValue1 and strValue2 are equal. |
|
1 |
The value of strValue1 is greater than the value of strValue2. |
Notes
This function is case-sensitive, which means the cases of the characters in a string affect the value of that string. To make a case-insensitive comparison, use StrCompareNoCase instead.
Examples
Given the following arguments, the return value is 0:
StrCompare("ABC","ABC")
Given the following arguments, the return value is -1:
StrCompare("ABC","DEF")
Given the following arguments, the return value is -2 and the quality is BAD:
StrCompare("ABC",123)