Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Caesar-cipher/OOC/caesar-cipher.ooc
Normal file
19
Task/Caesar-cipher/OOC/caesar-cipher.ooc
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
main: func (args: String[]) {
|
||||
shift := args[1] toInt()
|
||||
if (args length != 3) {
|
||||
"Usage: #{args[0]} [number] [sentence]" println()
|
||||
"Incorrect number of arguments." println()
|
||||
} else if (!shift && args[1] != "0"){
|
||||
"Usage: #{args[0]} [number] [sentence]" println()
|
||||
"Number is not a valid number." println()
|
||||
} else {
|
||||
str := ""
|
||||
for (c in args[2]) {
|
||||
if (c alpha?()) {
|
||||
c = (c lower?() ? 'a' : 'A') + (26 + c toLower() - 'a' + shift) % 26
|
||||
}
|
||||
str += c
|
||||
}
|
||||
str println()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue