Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 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