calculate_truncate_chars_length
Calculates the remaining character length after accounting for a replacement truncation string by decrementing the initial length for each non-combining character in the replacement text.
def calculate_truncate_chars_length(
length: int,
replacement: string
) - > int
Calculates the remaining character budget for a string after accounting for the visual length of a truncation replacement string.
Parameters
| Name | Type | Description |
|---|---|---|
| length | int | The total allowed character length for the truncated output. |
| replacement | string | The string or placeholder text to be appended when truncation occurs. |
Returns
| Type | Description |
|---|---|
int | The number of characters remaining for the original content after subtracting the non-combining characters found in the replacement text. |