Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 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