-
-
Save mrbodean/b0f0020e9322cba13caf to your computer and use it in GitHub Desktop.
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
<# | |
.Synopsis | |
Converts text in to Title Case | |
.EXAMPLE | |
Convert-ToTitleCase -Text "ThE wINDOWS PowerShell TFM book CONTEST aNd GiVeAwAy" | |
.EXAMPLE | |
"ThE wINDOWS PowerShell TFM book CONTEST aNd GiVeAwAy"|Convert-ToTitleCase | |
.INPUTS | |
[Sting] | |
.OUTPUTS | |
[String] | |
#> | |
function Convert-ToTitleCase | |
{ | |
[CmdletBinding()] | |
[OutputType([String])] | |
Param( | |
[Parameter(Mandatory=$true, | |
ValueFromPipeline=$true, | |
ValueFromPipelineByPropertyName=$true, | |
Position=0)] | |
[ValidateNotNull()] | |
[ValidateNotNullOrEmpty()] | |
$Text | |
)#Param | |
Begin{} | |
Process{ | |
(Get-Culture).TextInfo.ToTitleCase($text.ToLower()) | |
}#Process | |
End{} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment