Mega Code Archive

 
Categories / VB.Net Tutorial / Internationlization
 

Changes the casing of a string based on the English (United States) culture, with the culture name en-US

Imports System Imports System.Globalization Public Class SamplesTextInfo    Public Shared Sub Main()       Dim myString As String = "this IS a test"       ' Creates a TextInfo based on the "en-US" culture.       Dim myTI As TextInfo = New CultureInfo("en-US", False).TextInfo       ' Changes a string to lowercase.       Console.WriteLine("""{0}"" to lowercase: {1}", myString, myTI.ToLower(myString))       ' Changes a string to uppercase.       Console.WriteLine("""{0}"" to uppercase: {1}", myString, myTI.ToUpper(myString))       ' Changes a string to titlecase.       Console.WriteLine("""{0}"" to titlecase: {1}", myString, myTI.ToTitleCase(myString))    End Sub End Class