Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
3
Task/Rot-13/PowerShell/rot-13-1.psh
Normal file
3
Task/Rot-13/PowerShell/rot-13-1.psh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$e = "This is a test Guvf vf n grfg"
|
||||
|
||||
[char[]](0..64+78..90+65..77+91..96+110..122+97..109+123..255)[[char[]]$e] -join ""
|
||||
41
Task/Rot-13/PowerShell/rot-13-2.psh
Normal file
41
Task/Rot-13/PowerShell/rot-13-2.psh
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
function Invoke-Rot13 {
|
||||
param(
|
||||
[char[]]$message
|
||||
)
|
||||
begin {
|
||||
$outString = New-Object System.Collections.ArrayList
|
||||
$alpha = 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
|
||||
$alphaL = $alpha + $alpha
|
||||
$alphaU = $alphaL.toUpper()
|
||||
$int = 13
|
||||
}
|
||||
process{
|
||||
$message | ForEach-Object {
|
||||
# test if char is special
|
||||
if ($_ -match '[^\p{L}\p{Nd}]') {
|
||||
$outString += $_
|
||||
}
|
||||
# test if char is digit
|
||||
elseif ($_ -match '\d') {
|
||||
$outString += $_
|
||||
}
|
||||
# test if char is upperCase
|
||||
elseif ($_ -ceq $_.ToString().ToUpper()) {
|
||||
$charIndex = $alphaU.IndexOf($_.tostring())
|
||||
$outString += $alphaU[$charIndex+$int]
|
||||
}
|
||||
# test if char is lowerCase
|
||||
elseif ($_ -ceq $_.ToString().ToLower()) {
|
||||
$charIndex = $alphaL.IndexOf($_.tostring())
|
||||
$outString += $alphaL[$charIndex+$int]
|
||||
}
|
||||
else {
|
||||
$outString += $_
|
||||
}
|
||||
} # end foreach
|
||||
} # end process
|
||||
end {
|
||||
# output string and join all chars
|
||||
$outString -join ""
|
||||
}
|
||||
} # end function
|
||||
6
Task/Rot-13/PowerShell/rot-13-3.psh
Normal file
6
Task/Rot-13/PowerShell/rot-13-3.psh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
PS> $message = '{!This is /A\ Test123}'
|
||||
PS> $messageE = Invoke-Rot13 -message $message
|
||||
PS> $messageE
|
||||
PS> Invoke-Rot13 -message $messageE
|
||||
{!Guvf vf /N\ Grfg123}
|
||||
{!This is /A\ Test123}
|
||||
Loading…
Add table
Add a link
Reference in a new issue