Merge branch 'develop'

This commit is contained in:
2020-11-16 23:04:41 +00:00

View File

@@ -1,8 +1,10 @@
pub fn handify(input: &str) -> String { pub fn handify(input: &str) -> String {
let input = input.to_uppercase(); let input = input.to_uppercase();
let input = input.trim().to_owned(); let input = input.trim().to_owned();
let input = input.replace(" ", " 👏 "); let mut input = input.replace(" ", " 👏 ");
let input = format!("👏 {} 👏", input); if !input.is_empty() {
input = format!("👏 {} 👏", input);
}
input input
} }
@@ -17,3 +19,9 @@ fn handify_test_with_trailing_spaces() {
let input = " hello world "; let input = " hello world ";
assert_eq!(handify(input), "👏 HELLO 👏 WORLD 👏") assert_eq!(handify(input), "👏 HELLO 👏 WORLD 👏")
} }
#[test]
fn handify_test_empty_string() {
let input = "";
assert_eq!(handify(input), "");
}