Skip to content

Instantly share code, notes, and snippets.

@dfinke
Last active January 1, 2016 09:49
Show Gist options
  • Save dfinke/8127413 to your computer and use it in GitHub Desktop.
Save dfinke/8127413 to your computer and use it in GitHub Desktop.
Write-Output Merry Christmas And Happy New Year | ConvertTo-PigLatin
function ConvertTo-PigLatin {
param(
[Parameter(ValueFromPipeline)]
[string[]]$string
)
Process {
$r += $(foreach($s in $string) {
if(Write-Output b c d f g h j k l m n p q r s t v w x y z -eq $s[0]) {
"{0}{1}ay" -f ($s[1..($s.length)] -join ''), $s[0]
} else {
$s + "way"
}
}) + ' '
}
End {$r.Trim()}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment