Mega Code Archive

 
Categories / VB.Net / Data Types
 

Sample for String Compare(String, Int32, String, Int32, Int32, Boolean)

Imports System Imports Microsoft.VisualBasic Class Sample    Public Shared Sub Main()       Dim str1 As [String] = "MACHINE"       Dim str2 As [String] = "machine"       Dim str As [String]       Dim result As Integer       Console.WriteLine("str1 = '{0}', str2 = '{1}'", str1, str2)       Console.WriteLine("Ignore case:")       result = [String].Compare(str1, 2, str2, 2, 2, True)       str = IIf(result < 0, "less than", IIf(result > 0, "greater than", "equal to"))       Console.Write("Substring '{0}' in '{1}' is ", str1.Substring(2, 2), str1)       Console.Write("{0} ", str)       Console.WriteLine("substring '{0}' in '{1}'.", str2.Substring(2, 2), str2)    End Sub End Class