python_technical_primitives.text.operations¶
String utility operations.
Functions¶
|
Convert string to sentence case (first letter capitalized). |
|
Convert string to lowercase. |
|
Convert string to uppercase. |
|
Truncate string to max length with suffix. |
|
Normalize whitespace (collapse multiple spaces to single). |
|
Check if string is valid email format. |
|
Sanitize filename by removing/replacing invalid characters. |
|
Extract file extension from filename. |
Module Contents¶
- python_technical_primitives.text.operations.to_sentence_case(text: str) str¶
Convert string to sentence case (first letter capitalized).
- python_technical_primitives.text.operations.to_lower_case(text: str) str¶
Convert string to lowercase.
- python_technical_primitives.text.operations.to_upper_case(text: str) str¶
Convert string to uppercase.
- python_technical_primitives.text.operations.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
- python_technical_primitives.text.operations.normalize_whitespace(text: str) str¶
Normalize whitespace (collapse multiple spaces to single).
- python_technical_primitives.text.operations.is_valid_email(email: str) bool¶
Check if string is valid email format.
- python_technical_primitives.text.operations.sanitize_filename(filename: str) str¶
Sanitize filename by removing/replacing invalid characters.
- Args:
filename: Original filename
- Returns:
Sanitized filename safe for file systems
- python_technical_primitives.text.operations.extract_extension(filename: str) str | None¶
Extract file extension from filename.