Imports System
Imports System.Globalization
Public Class SamplesCompareInfo
Public Shared Sub Main()
Dim myStr1 As [String] = "this"
Dim myStr2 As [String] = "is"
Dim myXfix As [String] = "th"
' Uses the CompareInfo property of the InvariantCulture.
Dim myComp As CompareInfo = CultureInfo.InvariantCulture.CompareInfo
' Determines whether myXfix is a prefix of "calle" and "llegar".
Console.WriteLine("IsPrefix( {0}, {1} ) : {2}", myStr1, myXfix, myComp.IsPrefix(myStr1, myXfix))
Console.WriteLine("IsPrefix( {0}, {1} ) : {2}", myStr2, myXfix, myComp.IsPrefix(myStr2, myXfix))
' Determines whether myXfix is a suffix of "calle" and "llegar".
Console.WriteLine("IsSuffix( {0}, {1} ) : {2}", myStr1, myXfix, myComp.IsSuffix(myStr1, myXfix))
Console.WriteLine("IsSuffix( {0}, {1} ) : {2}", myStr2, myXfix, myComp.IsSuffix(myStr2, myXfix))
End Sub
End Class
|