本文整理匯總了VB.NET中System.Globalization.CompareInfo.IsSuffix方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET CompareInfo.IsSuffix方法的具體用法?VB.NET CompareInfo.IsSuffix怎麽用?VB.NET CompareInfo.IsSuffix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Globalization.CompareInfo
的用法示例。
在下文中一共展示了CompareInfo.IsSuffix方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: SamplesCompareInfo
' 導入命名空間
Imports System.Globalization
Public Class SamplesCompareInfo
Public Shared Sub Main()
' Defines the strings to compare.
Dim myStr1 As [String] = "calle"
Dim myStr2 As [String] = "llegar"
Dim myXfix As [String] = "lle"
' 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
輸出:
IsPrefix( calle, lle ) : False IsPrefix( llegar, lle ) : True IsSuffix( calle, lle ) : True IsSuffix( llegar, lle ) : False
示例2: SamplesCompareInfo
' 導入命名空間
Imports System.Globalization
Public Class SamplesCompareInfo
Public Shared Sub Main()
' Defines the strings to compare.
Dim myStr1 As [String] = "calle"
Dim myStr2 As [String] = "llegar"
Dim myXfix As [String] = "LLE"
' Uses the CompareInfo property of the InvariantCulture.
Dim myComp As CompareInfo = CultureInfo.InvariantCulture.CompareInfo
Console.WriteLine("IsSuffix ""{0}"", ""{1}""", myStr1, myXfix)
Console.WriteLine(" With no CompareOptions : {0}", myComp.IsSuffix(myStr1, myXfix))
Console.WriteLine(" With None : {0}", myComp.IsSuffix(myStr1, myXfix, CompareOptions.None))
Console.WriteLine(" With Ordinal : {0}", myComp.IsSuffix(myStr1, myXfix, CompareOptions.Ordinal))
Console.WriteLine(" With IgnoreCase : {0}", myComp.IsSuffix(myStr1, myXfix, CompareOptions.IgnoreCase))
Console.WriteLine("IsPrefix ""{0}"", ""{1}""", myStr2, myXfix)
Console.WriteLine(" With no CompareOptions : {0}", myComp.IsPrefix(myStr2, myXfix))
Console.WriteLine(" With None : {0}", myComp.IsPrefix(myStr2, myXfix, CompareOptions.None))
Console.WriteLine(" With Ordinal : {0}", myComp.IsPrefix(myStr2, myXfix, CompareOptions.Ordinal))
Console.WriteLine(" With IgnoreCase : {0}", myComp.IsPrefix(myStr2, myXfix, CompareOptions.IgnoreCase))
End Sub
End Class
輸出:
IsSuffix "calle", "LLE" With no CompareOptions : False With None : False With Ordinal : False With IgnoreCase : True IsPrefix "llegar", "LLE" With no CompareOptions : False With None : False With Ordinal : False With IgnoreCase : True