Trim
Removing whitespace from the start and end of a text value, so that a name followed by a stray space becomes equal to the same name without one.
Most trim functions leave the spaces inside a value alone, though some also collapse repeated inner spaces. Many remove only the ordinary space, so a non-breaking space pasted in from a web page survives and has to be handled separately.
Where it comes up
- Stray whitespace and invisible charactersTwo values look identical on screen but differ by a trailing space, a non-breaking space, or a hidden character.
See also
- WhitespaceCharacters that take up space without showing a mark: spaces, tabs, line breaks, and less obvious ones such as the non-breaking space.
- NormalizationConverting values to a common form or scale. The word is used for text (one case, one spacing), for numbers (a common range), and for database design (removing repetition).
- StringA value stored as a sequence of characters, which is to say text. The characters 2025 held as a string are four symbols, not a number.