Compare two substrings using different cultures and ignoring the case of the substrings : CultureInfo « I18N Internationlization « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » I18N Internationlization » CultureInfo 
18.1.5.Compare two substrings using different cultures and ignoring the case of the substrings
Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic

Class Sample

   Public Shared Sub Main()
      Dim str1 As [String"abc"
      Dim str2 As [String"ABC"
      Dim str As [String]
      Dim result As Integer

      Console.WriteLine("str1 = '{0}', str2 = '{1}'", str1, str2)
      Console.WriteLine("Ignore case, Turkish culture:")
      result = [String].Compare(str1, 4, str2, 42, True, New CultureInfo("tr-TR"))
      str = IIf(result < 0"less than", IIf(result > 0"greater than""equal to"))
      Console.Write("Substring '{0}' in '{1}' is ", str1.Substring(42), str1)
      Console.Write("{0} ", str)
      Console.WriteLine("substring '{0}' in '{1}'.", str2.Substring(42), str2)


      Console.WriteLine("Ignore case, invariant culture:")
      result = [String].Compare(str1, 4, str2, 42, True, CultureInfo.InvariantCulture)
      str = IIf(result < 0"less than", IIf(result > 0"greater than""equal to"))
      Console.Write("Substring '{0}' in '{1}' is ", str1.Substring(42), str1)
      Console.Write("{0} ", str)
      Console.WriteLine("substring '{0}' in '{1}'.", str2.Substring(42), str2)

   End Sub
End Class
18.1.CultureInfo
18.1.1.CultureInfo(de-DE)
18.1.2.Use all available culture type to format Date and currency
18.1.3.Creates a CompareInfo that uses the InvariantCulture.
18.1.4.Current week of the year is based on CultureInfo
18.1.5.Compare two substrings using different cultures and ignoring the case of the substrings
18.1.6.CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern
18.1.7.Specify a CultureInfo set to one of the cultures defined by that object
18.1.8.String representation of an object changes when it is formatted with three different IFormatProvider objects.
18.1.9.Changes the casing of a string based on the English (United States) culture, with the culture name en-US.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.