inxs.utils module¶
-
inxs.utils.
reduce_whitespaces
(text: str, translate_to_space: str = '\t\n\r\x0b\x0c', strip: str = 'lr') → str[source]¶ Reduces the whitespaces of the provided string by replacing any of the defined whitespaces with a simple space (U+20) and stripping consecutive ones to a single one.
Parameters: - text – The input string.
- translate_to_space – The characters that should are defined as whitespace. Defaults to all common whitespace characters from the ASCII set.
- strip – The ‘sides’ of the string to strip from any whitespace at all, indicated by ‘l’ for the beginning and/or ‘r’ for the end of the string.
Returns: The resulting string.