fmri/helpers.rs
1/// Checks if inserted string contains @
2pub fn check_character_collision(string: &str) -> Result<(), String> {
3 for char in string.chars() {
4 if char == '@' {
5 return Err(String::from("String cannot contain char \'@\'"));
6 }
7 }
8 Ok(())
9}
10
11/// Removes first and last characters if it is inputted character
12pub fn remove_first_and_last_characters(string: &str, character: char) -> String {
13 string
14 .trim_start_matches(character)
15 .trim_end_matches(character)
16 .to_owned()
17}