Move some more code.
This commit is contained in:
parent
7760ed0b58
commit
3493b2b81d
2 changed files with 16 additions and 32 deletions
11
confarchive/utils.py
Normal file
11
confarchive/utils.py
Normal 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 ""}'
|
||||
Loading…
Add table
Add a link
Reference in a new issue