diff --git a/scipost_django/common/utils/text.py b/scipost_django/common/utils/text.py index 25265f257628f6957fd8b035b8ee7c89e95e67bd..fd31069481d7ebb740e5ade316ee7f0aa70a1d2c 100644 --- a/scipost_django/common/utils/text.py +++ b/scipost_django/common/utils/text.py @@ -172,3 +172,10 @@ def remove_extra_spacing(text): Remove extra spacing from text in the form of multiple spaces. """ return " ".join(text.strip().split()) + + +def split_strip(text: str, delimiter=",") -> list[str]: + """ + Split a string by a delimiter and strip each part. + """ + return [part.strip() for part in text.split(delimiter)]