Format a count with singular/plural noun.
(count: usize, singular: &str, plural: &str)
| 691 | |
| 692 | /// Format a count with singular/plural noun. |
| 693 | fn format_count(count: usize, singular: &str, plural: &str) -> String { |
| 694 | if count == 1 { |
| 695 | format!("{} {}", count, singular) |
| 696 | } else { |
| 697 | format!("{} {}", count, plural) |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | // Tests |
| 702 |