Move some more code.

This commit is contained in:
Edward Betts 2023-09-25 15:20:01 +01:00
parent 7760ed0b58
commit 3493b2b81d
2 changed files with 16 additions and 32 deletions

11
confarchive/utils.py Normal file
View file

@ -0,0 +1,11 @@
"""Utility functions."""
def drop_start(s: str, start: str) -> str:
"""Remove text from the start of a string."""
return s[len(start) :] if s.startswith(start) else s
def plural(num: int, label: str) -> str:
"""Make plural version of label as appropriate."""
return f'{num:,d} {label}{"s" if num != 1 else ""}'