You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
323 B

pub fn plural<'a>(num: i32, singular_name: &'a str, plural_name: &'a str) -> &'a str {
match num {
1 => singular_name,
_ => plural_name,
}
}
pub fn n_plural<'a>(num: i32, singular_name: &'a str, plural_name: &'a str) -> String {
format!("{} {}", num, plural(num, singular_name, plural_name))
}