Created
August 28, 2019 08:21
-
-
Save 0ryant/cab2165922f4d9070f7eaaead5edf5b3 to your computer and use it in GitHub Desktop.
Mocking / Spongebob text converter
This file contains hidden or 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 Get-MockingText { | |
<# | |
.SYNOPSIS | |
This function changes a normal text string to a TeXt sTrInG LiKe tHiS | |
.DESCRIPTION | |
InTeRnEt cUlTuRe dEmAnDs a qUiCkEr aNd eAsIeR WaY Of tYpInG ThInGs lIkE ThIs. HeNcE ThIs fUnCtIoN. | |
.PARAMETER InputObject | |
TeXt tO ChAnGe tO MoCkInG TeXt. | |
.EXAMPLE | |
Get-MockingText -InputObject 'describe what this call does' | |
DeScRiBe wHaT ThIs cAlL DoEs | |
.EXAMPLE | |
'describe what this call does' | Get-MockingText | |
DeScRiBe wHaT ThIs cAlL DoEs | |
.NOTES | |
N/A | |
.LINK | |
URLs to related sites | |
.INPUTS | |
Strings, ints, chars | |
.OUTPUTS | |
String | |
#> | |
param( | |
[parameter(position=0)] | |
[string]$InputObject, | |
[parameter(valuefrompipeline,dontshow)] | |
[string]$String | |
) | |
if ($string){$inputobject=$string} | |
[string]$newString='' | |
for ($i=0;$i-le$($inputobject.length);$i++) { | |
try {$newString+=$($inputobject[$i].ToString().ToUpper()) | |
} catch {$newString+=$($inputobject[$i])} | |
$i++ | |
try {$newString+=$($inputobject[$i].ToString().ToLower()) | |
} catch {$newString+=$($inputobject[$i])} | |
} | |
write-output -InputObject $newString | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment