In Windows Forms applications, I have a helper function that takes care of this for me by calling an insanely long shared function in the .NET Framework.
Public Function FormatTitleCase(ByVal s As String) As StringThis function works beautifully. If I pass in "FUBAR", it returns "Fubar." However, in an ASP.NET application, it doesn't. It returns "FUBAR". Something is FUBAR here.
Return System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(s)
End Function
After talking to Scott McNairy, my ISV buddy at Microsoft, he made a small change that made it work in both WinForms and ASP.NET applications.
Public Function FormatTitleCase(ByVal s As String) As StringNow I'm really glad I made a helper function. Typing all that in every time to get a title case string...I shudder to think about the blisters.
Return System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(s.ToLower(System.Globalization.CultureInfo.InvariantCulture))
End Function
1 comment:
thank god. i thought i was going nuts.
Post a Comment