Net-informations.com
SiteMap  | About    

How to String Title Case

Title Case converts the first character of a word to uppercase and the rest of the characters to lowercase. The CultureInfo class renders culture-specific information, such as the associated language, sublanguage, country/region, calendar, and cultural conventions.

  System.Globalization.CultureInfo

A neutral culture is specified by only the two-letter lowercase language code. For example, "fr" specifies the neutral culture for French, and "de" specifies the neutral culture for German.

  Dim cultureInfo As New System.Globalization.CultureInfo("en-US")

The String class indirectly uses this class to obtain information about the default culture. The follwoing VB.NET source code shows how to convert a string to Title Case.




Public Class Form1

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Dim _str As String
		Dim cultureInfo As New System.Globalization.CultureInfo("en-US")
		_str = cultureInfo.TextInfo.ToTitleCase("make first letter capital")
		MsgBox(_str)
	End Sub

End Class






net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.