Comparing
A < B < a < b
Case Sensitive
This method is overloaded and is case sensitive by default.
System.String.Compare(sText1, sText2)
sText1 < sText2
System.String.Compare("aaa", "bbb") = -1 (less than zero)
sText1 > sText2
System.String.Compare("bbb", "aaa") = 1 (greater than zero)
sText1 = sText2
System.String.Compare("aaa", "aaa") = 0
sText1 <> sText2
System.String.Compare("aaa", "AAA") =
Case InSensitive
It is possible to compare strings and ignore the case
System.String.Compare(sText1, sText2, True)
sText1 = sText2
System.String.Compare("aaa", "AAA", True) = 0
Testing For Equality
There are two ways you can test to see if two strings are equal.
You can use the Equals method from one of the strings
string sFirstName;
string sLastName;
bequal = sFirstName.Equals(sLastName)
Or you can pass both the strings to the String class method.
string sFirstName;
string sLastName;
bequal = System.String.Equals(FirstName, sLastName)
VB.Net - Option Compare
By default this option is set to binary
This setting does not exist in C', because all string comparisons are case sensitive.
By default in VB string comparisons are not case sensitive
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext