python_technical_primitives.text.operations =========================================== .. py:module:: python_technical_primitives.text.operations .. autoapi-nested-parse:: String utility operations. Functions --------- .. autoapisummary:: python_technical_primitives.text.operations.to_sentence_case python_technical_primitives.text.operations.to_lower_case python_technical_primitives.text.operations.to_upper_case python_technical_primitives.text.operations.truncate python_technical_primitives.text.operations.normalize_whitespace python_technical_primitives.text.operations.is_valid_email python_technical_primitives.text.operations.sanitize_filename python_technical_primitives.text.operations.extract_extension Module Contents --------------- .. py:function:: to_sentence_case(text: str) -> str Convert string to sentence case (first letter capitalized). .. py:function:: to_lower_case(text: str) -> str Convert string to lowercase. .. py:function:: to_upper_case(text: str) -> str Convert string to uppercase. .. py:function:: truncate(text: str, max_length: int, suffix: str = '...') -> str Truncate string to max length with suffix. Args: text: String to truncate max_length: Maximum length including suffix suffix: Suffix to add if truncated Returns: Truncated string .. py:function:: normalize_whitespace(text: str) -> str Normalize whitespace (collapse multiple spaces to single). .. py:function:: is_valid_email(email: str) -> bool Check if string is valid email format. .. py:function:: sanitize_filename(filename: str) -> str Sanitize filename by removing/replacing invalid characters. Args: filename: Original filename Returns: Sanitized filename safe for file systems .. py:function:: extract_extension(filename: str) -> Optional[str] Extract file extension from filename.