rxn.utilities.strings.remove_prefix
- rxn.utilities.strings.remove_prefix(text, prefix, raise_if_missing=False)[source]
Removes a prefix from a string, if present at its beginning.
- Parameters
text (
str
) – string potentially containing a prefix.prefix (
str
) – string to remove at the beginning of text.raise_if_missing (
bool
, default:False
) – whether to raise a ValueError if the prefix is not found.
- Raises
ValueError – if the prefix is not found and raise_if_missing is True.
- Return type
str