[O] Use doctests
This commit is contained in:
@@ -34,15 +34,12 @@ def camel_split(camel: str) -> list[str]:
|
|||||||
def substr_between(s: str, start: str | None = None, end: str | None = None):
|
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