SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 7ccbb9c6 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add string split-strip text utility

parent bd378909
No related branches found
No related tags found
No related merge requests found
...@@ -172,3 +172,10 @@ def remove_extra_spacing(text): ...@@ -172,3 +172,10 @@ def remove_extra_spacing(text):
Remove extra spacing from text in the form of multiple spaces. Remove extra spacing from text in the form of multiple spaces.
""" """
return " ".join(text.strip().split()) 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)]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment