Last active
February 2, 2018 01:00
-
-
Save ryanspletzer/08c4dcb7126f55f93ac04cbc5520fd01 to your computer and use it in GitHub Desktop.
ConvertTo-TheLettersAndNumbers.ps1
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 ConvertTo-TheLettersAndNumbers { | |
[CmdletBinding()] | |
[OutputType([string])] | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string] | |
$String | |
) | |
$numbers = @{ | |
0 = ':zero:' | |
1 = ':one:' | |
2 = ':two:' | |
3 = ':three:' | |
4 = ':four:' | |
5 = ':five:' | |
6 = ':six:' | |
7 = ':seven:' | |
8 = ':eight:' | |
9 = ':nine:' | |
} | |
$String = ($String -replace '([a-zA-Z])',':the_$1:').ToLower() | |
foreach ($number in $numbers.Keys) { | |
$String = $String.Replace($number, $numbers[$number])) | |
} | |
Write-Output -InputObject $String | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment