Spelling Numbers in Words
Can you write a function which spells out whole numbers as words? For example, 108 becomes "One hundred and eight".
For the sake of the puzzle you should make sure that your solution handles the following
- Negative numbers should be preceded by a "Minus", e.g. "Minus seventeen"
- Use UK English usage of the word "and", e.g "One hundred and eight", not the US "One hundred eight"
- Use commas after every group, e.g. "Two million, six hundred and sixteen thousand, eight hundred and one"
- Standard use of a hyphen, e.g. "Twenty-six", "Two thousand, one hundred and twenty-six"
Examples:
SpellNumber 0 Zero SpellNumber ¯8 Minus eight Spell Number 10001 Ten thousand and one Spell Number 1234567890 One billion, two hundred and thirty-four million, five hundred and sixty-seven thousand, eight hundred and ninety
>> The Solution
Author: SimonMarsden