mpylab.tools.text moduleΒΆ

Text and string helper functions.

mpylab.tools.text.case_insensitive_string_compare(s1: str, s2: str) bool

Compare strings case-insensitively.

If s1 or s2 are not strings, False is returned.

mpylab.tools.text.format_block(block, nlspaces=0)

Format an indented multiline text block.

Leading/trailing empty lines are removed and common leading whitespace is stripped. This is useful for embedded INI or DAT snippets in triple-quoted Python strings.

mpylab.tools.text.map2singlechar(i)

Map integer index to compact alphanumeric symbol.

mpylab.tools.text.normalize_string(text: str) str

Return a normalized version (NFKD) of the input string text.

The normal form KD (NFKD) applies compatibility decomposition, replacing compatibility characters with their equivalents.