MCPcopy Create free account
hub / github.com/KnowledgeXLab/LeanRAG / split_string_by_multi_markers

Function split_string_by_multi_markers

tools/_utils.py:180–185  ·  view source on GitHub ↗

Split a string by multiple markers

(content: str, markers: list[str])

Source from the content-addressed store, hash-verified

178
179
180def split_string_by_multi_markers(content: str, markers: list[str]) -> list[str]:
181 """Split a string by multiple markers"""
182 if not markers:
183 return [content]
184 results = re.split("|".join(re.escape(marker) for marker in markers), content)
185 return [r.strip() for r in results if r.strip()]
186
187
188def enclose_string_with_quotes(content: Any) -> str:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected