What is the best way to normalize whitespace characters (space, newline, tab) in a Prolog atom, e.g. in SWI-Prolog. I.e. I would like to have a rule:
normalize_space_in_atom(+Atom1, -Atom2)
such that Atom2
- has any sequence of whitespace characters turned into a single space
- starts with a non-space
- ends with a non-space