1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/// Parse formats to recase from command line arguments. Now it removes spaces from formats.
pub fn preprocess_formats(formats: &Vec<String>) -> Vec<String> {
    formats
        .into_iter()
        .map(|format| remove_spaces(format))
        .collect()
}

fn remove_spaces(string: &str) -> String {
    string.replace(" ", "")
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn remove_spaces_test() {
        let string = "pdf, epub, txt,      jpeg";

        assert_eq!(remove_spaces(string), "pdf,epub,txt,jpeg");
    }
}