Public Function TitleCase(ByVal strIn As String)
Dim result As String = ""
Dim culture As New CultureInfo("en", False)
Dim tInfo As TextInfo = culture.TextInfo()
result = tInfo.ToTitleCase(strIn)
Return result
End Function
If I input "TEST" into the function above. The output is "TEST". Ideally it would output "Test"
I also tried the code snippets from this post to no avail: Use of ToTitleCase
If memory serves, ToTitleCase() never seemed to work for all capitalized strings. It basically requires you to convert the string to lowercase prior to processing.
From the MSDN:
Generally, title casing converts the first character of a word to uppercase and the rest of the characters to lowercase. However, this method does not currently provide proper casing to convert a word that is entirely uppercase, such as an acronym.
Workaround Usage (in C#):
string yourString = "TEST";
TextInfo formatter = new CultureInfo("en-US", false).TextInfo;
formatter.ToTitleCase(yourString.ToLower());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With