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

Extract and sum numbers

Problem

Pull every whole number out of the string order 12 apples, 3 pears and 25 plums, print them, and print their sum.

Example

The program prints:

numbers: 12 3 25
sum: 40

Solution

See the solution

Course navigation

Regexes and grammars   |   Solution: Extract and sum numbers