Handles cleaning user input for colour formats.
Its purpose is to strip unit symbols (%, º, deg) from numeric values so that format modules can parse them without errors.
Summary
Functions
Cleans a string by removing common unit suffixes. Examples
Cleans a list of strings or a delimiter-separated string. Useful for inputs like "360º, 50%, 50%".
Functions
Cleans a string by removing common unit suffixes. Examples:
- "360º" -> "360"
- "50%" -> "50"
- "12.5 deg" -> "12.5"
Raises ArgumentError if the input is not a binary. Use
sanitize_list/2 for non-binary inputs (lists) or pre-validate.
Cleans a list of strings or a delimiter-separated string. Useful for inputs like "360º, 50%, 50%".
The binary variant returns {:error, :invalid_input} if the
separator is invalid (not a binary). The list variant returns
{:error, :invalid_input} if the input is not a list.