Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<#
.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