-
-
Save anonymous/13c92dbfff3c7203353b to your computer and use it in GitHub Desktop.
Windows PowerShell TFM Book Contest and Giveaway
This file contains 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
function Format-TitleCase { | |
<# | |
.SYNOPSIS | |
Takes a string of text in any case and formats it to the first letter in every word as capital. | |
.DESCRIPTION | |
Format-TitleCase is a function that changes a strin of test to capitalize the first letter in every word, | |
ignoring special characters and numbers. | |
.PARAMETER Words | |
String of text to format. | |
.EXAMPLE | |
Format-TitleCase 'StrIng oF teXT' | |
'StrIng oF teXT' | Format-TitleCase | |
.NOTES | |
Created John Raley | |
#> | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory, | |
ValueFromPipeline)] | |
[String]$words | |
) | |
process { | |
$TextInfo = (Get-Culture).TextInfo | |
$TextInfo.ToTitleCase($words.ToLower()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment