continue-custom/server/continuedev/plugins/context_providers/util.py
김보경/DAXTF 20994cd4a1
Fix query strip problem (#594)
* add_func_remove_prefix_and_suffix_on_util

* fix_query_strip_with_added_func
2023-11-01 10:50:06 -07:00

17 lines
381 B
Python

import re
def remove_meilisearch_disallowed_chars(id: str) -> str:
return re.sub(r"[^0-9a-zA-Z_-]", "", id)
def remove_prefix(text: str, prefix: str) -> str:
if text.startswith(prefix):
return text[len(prefix):]
return text
def remove_suffix(text: str, suffix: str) -> str:
if text.endswith(suffix):
return text[:-len(suffix)]
return text