Start Back Next End
  
ZBasic System Library
314
ZBasic Microcontrollers
StrCompare
Type
Function returning Integer
Invocation
StrCompare(str1, str2)
StrCompare(str1, str2, ignoreCase)
Parameter
Method
Type
Description
str1
ByVal
String
The first string to compare.
str2
ByVal
String
The second string to compare.
ignoreCase
ByVal
Boolean
A flag controlling whether alphabetic case is significant.
Discussion
This function returns a value indicating the “sort order” of the two strings.  If the returned value is
negative, the first string precedes the second in sort order, i.e. the first string would appear before the
second in a list sorted alphabetically.  If the returned value is zero, the strings have the same sort order
and if it is greater than zero, the second string has a higher sort order.  If the optional ignoreCase
parameter is given, the comparison is done either observing or ignoring differences in alphabetic case
depending on the value of the parameter.  For the purposes of this parameter only the characters A-Z and
a-z (&H41 to &H5a and &H61 to &H7a) are considered to be alphabetic.  If the ignoreCase parameter is
omitted, the comparison is performed observing case differences.
Example
Dim str1 as String
Dim str2 as String
If (StrCompare(str1, str2, true) = 0) Then
Debug.Print "The strings match"
End If
Compatibility
This function is not available in BasicX compatibility mode.
See Also
Previous page Top Next page