conference-archive/confarchive/utils.py

12 lines
331 B
Python
Raw Normal View History

2023-09-25 15:20:01 +01:00
"""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 ""}'