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.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.camel_case(string)[source]

Convert the given string to camel case.

Parameters

string (str) –

Return type

str

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

Convert the given string to mixed case.

Parameters

string (str) –

Return type

str

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

Convert the given string to mixed snake 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

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

Split a string on new capital letters and not alphanumeric characters.

Parameters

string (str) –

Return type

List[str]

class xsdata.utils.text.StringType[source]

Bases: object

UPPER = 1
LOWER = 2
NUMERIC = 3
OTHER = 4
xsdata.utils.text.classify(character)[source]

String classifier.

Parameters

character (str) –

Return type

int