xsdata.utils.text module

xsdata.utils.text.prefix(string, sep=':')[source]

Return the first part of the string before the separator.

Parameters
  • string (str) –

  • sep (str) –

Return type

str

xsdata.utils.text.suffix(string, sep=':')[source]

Return the last part of the string after the separator.

Parameters
  • string (str) –

  • sep (str) –

Return type

str

xsdata.utils.text.split(string, sep=':')[source]

Separate the given string with the given separator and return a tuple of the prefix and suffix.

If the separator isn’t present in the string return None as prefix.

Parameters
  • string (str) –

  • sep (str) –

Return type

Tuple

xsdata.utils.text.collapse_whitespace(string)[source]

Remove excess whitespace and duplicate words.

Parameters

string (str) –

Return type

str

xsdata.utils.text.capitalize(string)[source]

Capitalize the given string.

Parameters

string (str) –

Return type

str

xsdata.utils.text.pascal_case(string)[source]

Convert the given string to pascal case.

Parameters

string (str) –

Return type

str

xsdata.utils.text.snake_case(string)[source]

Convert the given string to snake case.

Parameters

string (str) –

Return type

str