string module

toolbox.string.camel_to_snake(name: str) str

Convert camelCase or PascalCase to snake_case.

Args:

name (str): The camelCase or PascalCase string.

Returns:

str: The snake_case representation.

toolbox.string.compress_string(text: str) str

Compress a UTF-8 string using zlib and encode the result in base64.

Args:

text (str): The input string to compress.

Returns:

str: The base64-encoded compressed string.

toolbox.string.count_words(text: str) int

Count words in a string.

Args:

text (str): The input string.

Returns:

int: Number of words.

toolbox.string.decompress_string(text: str) str

Decode a base64-encoded string and decompress it using zlib.

Args:

text (str): The base64-encoded compressed string.

Returns:

str: The decompressed UTF-8 string.

toolbox.string.kebab_case(text: str) str

Convert a string to kebab-case.

Args:

text (str): The input string (snake_case, camelCase, or spaces).

Returns:

str: The kebab-case representation.

toolbox.string.remove_accents(text: str) str

Remove accents and diacritics from a string.

Args:

text (str): The input string.

Returns:

str: String with accents removed.

toolbox.string.reverse_string(text: str) str

Reverse a string.

Args:

text (str): The input string.

Returns:

str: The reversed string.

toolbox.string.slugify(value: str) str

Convert a string to a slug suitable for URLs.

Args:

value (str): The input string.

Returns:

str: A slugified version of the string.

toolbox.string.snake_to_camel(name: str) str

Convert snake_case to CamelCase.

Args:

name (str): The snake_case string.

Returns:

str: The CamelCase representation.

toolbox.string.strip_html(text: str) str

Remove HTML tags from a string.

Args:

text (str): The input string with HTML.

Returns:

str: String with HTML tags removed.

toolbox.string.title_case(text: str) str

Convert a string to title case, handling special words correctly.

Args:

text (str): The input string.

Returns:

str: Title-cased string.

toolbox.string.truncate(text: str, length: int, suffix: str = '...') str

Truncate a string to a maximum length, adding a suffix if truncated.

Args:

text (str): The text to truncate. length (int): Maximum length (including suffix). suffix (str, optional): Suffix to add if truncated. Defaults to ‘…’.

Returns:

str: The truncated string.

toolbox.string.wrap_text(text: str, width: int) List[str]

Wrap text to a specific width.

Args:

text (str): The text to wrap. width (int): Maximum line width.

Returns:

List[str]: List of wrapped lines.