Last active
May 2, 2018 14:28
-
-
Save metinsaylan/6c3f3828fdf8ff89512247d405e571ac to your computer and use it in GitHub Desktop.
VB .NET String Extension to convert string to Title Case - https://metinsaylan.com/6568/string-extension-method-convert-string-title-case-vb-net/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Globalization | |
Imports System.Runtime.CompilerServices | |
Public Module StringExtensions | |
''' <summary> | |
''' This extension function converts a string to TitleCase. | |
''' </summary> | |
''' <param name="inputString">String to convert.</param> | |
''' <returns>Converted string.</returns> | |
<Extension()> | |
Public Function ToTitleCase(inputString As String) As String | |
If (String.IsNullOrEmpty(inputString)) Then | |
Return inputString | |
End If | |
Return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(inputString.ToLower) | |
End Function | |
End Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment