ps/Modules/Cole.PowerShell.Developer/Public/Get-ChatFunkyString.ps1
2023-05-30 22:51:22 -07:00

97 lines
2.3 KiB
PowerShell

Function Get-ChatFunkyString {
param (
[string]$str
)
if ([string]::IsNullOrWhiteSpace($str)) {
Write-Host "Can't funkitize an empty string"
return
}
$replacements = @{
"0" = ":x01:"
"1" = ":x11:"
"2" = ":x21:"
"3" = ":x31:"
"4" = ":x41:"
"5" = ":x51:"
"6" = ":x61:"
"7" = ":x71:"
"8" = ":x81:"
"9" = ":x91:"
"a" = ":xa1:"
"&" = ":xampersand1:"
"'" = ":xapostrophe1:"
"*" = ":xasterisk1:"
"@" = ":xatsymbol1:"
"b" = ":xb1:"
"\" = ":xbackslash1:"
"c" = ":xc1:"
"^" = ":xcarat1:"
":" = ":xcolon1:"
"," = ":xcomma1:"
"d" = ":xd1:"
"$" = ":xdollarsign1:"
"`"" = ":xdoublequote1:"
"e" = ":xe1:"
"=" = ":xequals1:"
"!" = ":xexclamation1:"
"f" = ":xf1:"
"/" = ":xforwardslash1:"
"g" = ":xg1:"
">" = ":xgreaterthan1:"
"h" = ":xh1:"
"i" = ":xi1:"
"j" = ":xj1:"
"k" = ":xk1:"
"l" = ":xl1:"
"{" = ":xleftcurlybrace1:"
"(" = ":xleftparenthesis1:"
"[" = ":xleftsquarebracket1:"
"<" = ":xlessthan1:"
"m" = ":xm1:"
"-" = ":xminus1:"
"n" = ":xn1:"
"o" = ":xo1:"
"`#" = ":xoctothorpe1:"
"p" = ":xp1:"
"%" = ":xpercent1:"
"." = ":xperiod1:"
"|" = ":xpipe1:"
"+" = ":xplus1:"
"q" = ":xq1:"
"?" = ":xquestion1:"
"r" = ":xr1:"
"}" = ":xrightcurlybrace1:"
")" = ":xrightparenthesis1:"
"]" = ":xrightsquarebracket1:"
"s" = ":xs1:"
";" = ":xsemicolon1:"
" " = ":xspace1:"
"t" = ":xt1:"
"~" = ":xtilde1:"
"u" = ":xu1:"
"_" = ":xunderscore1:"
"v" = ":xv1:"
"w" = ":xw1:"
"x" = ":xx1:"
"y" = ":xy1:"
"z" = ":xz1:"
}
$inArr = $str.ToCharArray()
$finalString = ""
foreach($char in $inArr) {
$replacement = $replacements[([string]$char).ToLower()]
if ([string]::IsNullOrEmpty($replacement)) {
$replacement = $char
}
$finalString += $replacement
}
Set-Clipboard $finalString
Write-Host "the value is now on your clipboard"
}