Skip to content

Instantly share code, notes, and snippets.

@0ryant
Created August 28, 2019 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0ryant/cab2165922f4d9070f7eaaead5edf5b3 to your computer and use it in GitHub Desktop.
Save 0ryant/cab2165922f4d9070f7eaaead5edf5b3 to your computer and use it in GitHub Desktop.
Mocking / Spongebob text converter
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