normalize_whitespace
Normalizes whitespace in a string by replacing all occurrences of ASCII whitespace characters with a single space.
def normalize_whitespace(
string: string
) - > string
Replaces all occurrences of ASCII whitespace characters with a single space to ensure consistent string formatting.
Parameters
| Name | Type | Description |
|---|---|---|
| string | string | The input text containing potential tabs, newlines, or multiple spaces to be normalized. |
Returns
| Type | Description |
|---|---|
string | The processed string with all whitespace sequences collapsed into single spaces. |