diff --git a/fmtr/tools/string_tools.py b/fmtr/tools/string_tools.py index dd26a80..1c77bb4 100644 --- a/fmtr/tools/string_tools.py +++ b/fmtr/tools/string_tools.py @@ -4,6 +4,8 @@ from string import Formatter from typing import List +from fmtr.tools.datatype_tools import is_none + ELLIPSIS = '…' formatter = Formatter() @@ -106,6 +108,18 @@ def flatten(raw): return text +def join(strings, sep=' '): + """ + + Join a list of strings while removing Nones + + """ + + lines = [string for string in strings if not is_none(string) and string != ''] + text = sep.join(str(line) for line in lines) + return text + + class Mask: """ diff --git a/fmtr/tools/version b/fmtr/tools/version index 8684498..492b167 100644 --- a/fmtr/tools/version +++ b/fmtr/tools/version @@ -1 +1 @@ -1.0.11 \ No newline at end of file +1.0.12 \ No newline at end of file