VB.NET ToTitleCase FunctionThis VB.NET program uses the ToTitleCase Function from System.Globalization. It makes each word title case.
uppercases each word in a String. Custom-developed algorithms may be superior. But the ToTitleCase function from System.Globalization is more convenient. It is effective in most VB.NET program contexts.TextInfo
Info: This example shows the ToTitleCase method on TextInfo from System.Globalization.
Example. Please notice how this program imports the System.Globalization namespace. In Main, it uses the TextInfo instance on CultureInfo.CurrentCulture and calls ToTitleCase. The output has each letter following a space or period uppercased.
VB.NET program that uses ToTitleCase
Dim value As String = "dot net perls vb.net"
Dim title As String = CultureInfo.CurrentCulture.
Dot Net Perls Vb.Net
ToTitleCase does not contain extensive logic. It cannot handle special cases. For example, the acronym "VB.NET" is not uppercased correctly. To solve this problem, you can call Replace on every special case you require.Replace
There are many ways to do the same basic tasks in the .NET Framework. ToTitleCase is built into the .NET Framework for you, but it cannot cover every possible case you might require.
Therefore: It is sometimes necessary to design custom algorithms to uppercase words in a string.Uppercase First
© 2007-2020 Sam Allen. Every person is special and unique. Send bug reports to firstname.lastname@example.org.