Mega Code Archive

 
Categories / VB.Net / Internationalization
 

Comparing and Sorting Data for a Specific Culture

Imports System.Threading Imports System.Globalization Public Class TestClass    Public Shared Sub Main()       Dim str1 As String = "Apple"       Dim str2 As String = "Æble"       ' Set the current culture to Danish in Denmark.       Thread.CurrentThread.CurrentCulture = New CultureInfo("da-DK")       Dim result1 As Integer = [String].Compare(str1, str2)       Console.WriteLine(result1)       ' Set the current culture to English in the U.S.       Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")       Dim result2 As Integer = [String].Compare(str1, str2)       Console.WriteLine(result2)    End Sub End Class