rxn.utilities.strings.remove_postfix

rxn.utilities.strings.remove_postfix(text, postfix, raise_if_missing=False)[source]

Removes a postfix from a string, if present at its end.

Parameters
  • text (str) – string potentially containing a postfix.

  • postfix (str) – string to remove at the end of text.

  • raise_if_missing (bool, default: False) – whether to raise a ValueError if the postfix is not found.

Raises

ValueError – if the postfix is not found and raise_if_missing is True.

Return type

str