Rot-13: Difference between revisions
Jakt
(Rot-13 in Chipmunk Basic, MSX Basic and True BASIC) |
(Jakt) |
||
Line 2,263:
Compare with the solution to the [[Change_string_case#J|Change String Case]] task.
=={{header|Jakt}}==
<syntaxhighlight lang="jakt">
fn rot_13(anon string: String) throws -> String {
mut builder = StringBuilder::create()
for code_point in string.code_points() {
builder.append(match code_point {
'a'..'n' => code_point + 13
'n'..('z' + 1) => code_point - 13
'A'..'N' => code_point + 13
'N'..('Z' + 1) => code_point - 13
else => code_point
})
}
return builder.to_string()
}
fn main() {
println("{}", rot_13("The quick brown fox jumps over the lazy dog."))
}
</syntaxhighlight>
=={{header|Java}}==
|