Progress Monitor for IdealProgrammer.com
Take Swift, Intelligent, Massive, Planned, Loving, Effective (S.I.M.P.L.E.) Action to Transform Self into Ideal
Skip Repetitive Navigational Links
Home
News
Presenters
Register
Contact
Categories
Titles
Converter
Code Samples
C# ASP.NET
C# Console
HTML
JavaScript
SQL Server
VB ASP.NET
VB Console
Please login
VB.NET StrComp()
Description:
Illustrates using VB.NET StrComp() Code Example.
Example Class:
Public Class clsStrComp Public Sub Main() '**************************************************************************************** ' Example #1: StrComp(string1,string2,comparemethod) - returns integer ' Returns -1, 0, or 1, based on the result of a string comparison. ' -1 String1 sorts ahead of String2 ' 0 String1 is equal to String2 ' 1 String1 sorts after String2 ' comparemethod - Optional. Specifies the type of string comparison. If Compare is omitted, ' the Option Compare setting determines the compare method '**************************************************************************************** Console.WriteLine("Example #1: StrComp(string1,string2,comparemethod) ") Dim strString1 As String = "XYZ" Dim strString2 As String = "xyz" ' Return Uppercase Console.WriteLine(StrComp(strString1, strString2, CompareMethod.Text).ToString) 'Returns 0 Console.WriteLine(StrComp(strString1, strString2, CompareMethod.Binary).ToString) 'Returns -1 strString2 = "ABC" Console.WriteLine(StrComp(strString1, strString2).ToString) 'Returns 1 'write blank line to make output easier to read Console.WriteLine() 'Prevent console from closing before you press enter Console.ReadLine() End Sub End Class
Example Module:
Module Module1 Sub Main() Dim myclsStrComp As New clsStrComp myclsStrComp.Main() End Sub End Module
Home
News
Presenters
Register
Contact
Categories
Titles
Converter
Code Samples
C# ASP.NET
C# Console
HTML
JavaScript
SQL Server
VB ASP.NET
VB Console