quackamollie.core.utils.str_management module¶
- quackamollie.core.utils.str_management.camel_to_snake(s: str) str[source]¶
Convert CamelCase string to snake_case. Function from https://stackoverflow.com/a/44969381
- Parameters:
s (str) – A CamelCase string
- Returns:
A snake_case string
- Return type:
str
- quackamollie.core.utils.str_management.sanitize_username(input_str: str | None) str | None[source]¶
Sanitize a string from username or assimilated data in order to export it safely to Json format. It doesn’t really mater if there is data loss because the user is referenced by user ID, it is more to give an idea of whom this is than its exact name
- Parameters:
input_str (Optional[str]) – The string to sanitize
- Returns:
The sanitized string
- Return type:
Optional[str]