Compare two string ignoring case : String Compare « Data Types « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » Data Types » String CompareScreenshots 
Compare two string ignoring case
  

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, 22, True)
      str = IIf(result < 0"less than", IIf(result > 0"greater than""equal to"))
      Console.Write("Substring '{0}' in '{1}' is ", str1.Substring(22), str1)
      Console.Write("{0} ", str)
      Console.WriteLine("substring '{0}' in '{1}'.", str2.Substring(22), str2)

   End Sub
End Class

   
    
  
Related examples in the same category
1.Compares two strings using different CompareOptions settings.
2.Compare string with CompareOptions.None
3.Compare With Ordinal
4.Compare With StringSort
5.Compare with With IgnoreCase
6.Compare With IgnoreSymbols
7.Compare With IgnoreCase and IgnoreSymbols
8.calling the Compare method.
9.Compare two strings case-sensitively
10.Sample for String.Compare(String, Int32, String, Int32, Int32, Boolean)
11.String.Equals(Object), String.Equals(String), String.Equals(String, String)
12.Generic and nongeneric versions of the CompareTo method for String value
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.