Last active
September 8, 2019 22:26
-
-
Save sassman/8e36a3f45d12bcaa5d31d05aff97eb0d to your computer and use it in GitHub Desktop.
rust tdd: src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/lib.rs | |
pub fn alphabet_position(s: &str) -> String { | |
s.to_lowercase() // <-- adding this line | |
.chars() | |
.map(|x| -> u8 { x as u8 - 'a' as u8 + 1 }) | |
.map(|x| -> String { x.to_string() }) | |
.collect::<Vec<String>>() | |
.join(" ") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment