fmri 1.0.3

Implementation of IPS package identifier - FMRI
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Checks if inserted string contains @
pub fn check_character_collision(string: &str) -> Result<(), String> {
    for char in string.chars() {
        if char == '@' {
            return Err(String::from("String cannot contain char \'@\'"));
        }
    }
    Ok(())
}

/// Removes first and last characters if it is inputted character
pub fn remove_first_and_last_characters(string: &str, character: char) -> String {
    string
        .trim_start_matches(character)
        .trim_end_matches(character)
        .to_owned()
}