RosettaCodeData/Task/Rot-13/Jakt/rot-13.jakt
2023-07-01 13:44:08 -04:00

18 lines
522 B
Text

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."))
}