[O] Use doctests
This commit is contained in:
@@ -35,14 +35,11 @@ def substr_between(s: str, start: str | None = None, end: str | None = None):
|
|||||||
"""
|
"""
|
||||||
Get substring between two strings
|
Get substring between two strings
|
||||||
|
|
||||||
:param s: E.g. "Foo abc Bar"
|
>>> substr_between('abc { meow } def', '{', '}')
|
||||||
:param start: E.g. "Foo"
|
' meow '
|
||||||
:param end: E.g. "Bar"
|
|
||||||
:return: E.g. " abc "
|
|
||||||
"""
|
"""
|
||||||
if start:
|
if start:
|
||||||
s = s[s.index(start) + len(start):]
|
s = s[s.index(start) + len(start):]
|
||||||
if end:
|
if end:
|
||||||
s = s[:s.index(end)]
|
s = s[:s.index(end)]
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user