Most people know how to convert a string to all upper case or all lower case. In this quick tip, I’ll show you how to use ‘TextInfo’ to convert a string to Title Case.
$string = 'test string' [System.Threading.Thread]::CurrentThread.CurrentCulture.TextInfo.ToTitleCase($string)
As you see if you test it out your self, it will output ‘Test String’. The ToTitleCase method will capitalize all words in the string.
If, on the other hand, you would like to only capitalize the first word in a sentence, the following small function might come in handy: