From ac647a37a840e39bec3927d6c8388e73ba747159 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Tue, 15 Mar 2022 13:37:57 -0700 Subject: [PATCH] Let comma_space_split return empty list if string is all blank. --- voussoirkit/stringtools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/voussoirkit/stringtools.py b/voussoirkit/stringtools.py index 83a7693..3fba9d7 100644 --- a/voussoirkit/stringtools.py +++ b/voussoirkit/stringtools.py @@ -26,7 +26,8 @@ def comma_space_split(text) -> list: ''' if text is None: return text - return re.split(r'[ ,]+', text.strip()) + parts = re.split(r'[ ,]+', text.strip()) + return [part for part in parts if part] def excise(text, mark_left, mark_right) -> str: '''