You are viewing a single comment's thread. Return to all comments →
My rust solution:
fn caesarCipher(s: &str, k: u8) -> String { s.bytes() .map(|b| { if b.is_ascii_alphabetic() { let first_letter = if b.is_ascii_lowercase() { b'a' } else { b'A' }; char::from((((b - first_letter) + k) % 26) + first_letter).to_string() } else { char::from(b).to_string() } }) .collect::<Vec<String>>() .join("") }
Seems like cookies are disabled on this browser, please enable them to open this website
Caesar Cipher
You are viewing a single comment's thread. Return to all comments →
My rust solution: