Compares two strings using different CompareOptions settings.
Imports System
Imports System.Globalization
Public Class SamplesCompareInfo
Public Shared Sub Main()
Dim myStr1 As [String] = "Bill's"
Dim myStr2 As [String] = "bills"
' Creates a CompareInfo that uses the InvariantCulture.
Dim myComp As CompareInfo = CultureInfo.InvariantCulture.CompareInfo
' Compares two strings using myComp.
Console.WriteLine("Comparing ""{0}"" and ""{1}""", myStr1, myStr2)
Console.WriteLine(" With no CompareOptions : {0}", myComp.Compare(myStr1, myStr2))
End Sub
End Class
Related examples in the same category