Course of Raku / Addendum 🆕 / Types and text machines / Regexes and grammars / Exercises

Normalise whitespace

Problem

Clean up the string ' too many spaces ' so that leading and trailing spaces are gone and every internal gap is a single space. Print the result.

Example

The program prints:

too many spaces

Solution

See the solution

Course navigation

Solution: Parse a date with named captures   |   Solution: Normalise whitespace