Using the British short scale notation, write a function to return the correct spelling of a number passed as a numeric string including decimal places. The function should be able to accept spaces, commas and leading zeros. Numbers beginning with '.' should return 'Zero point something' and numbers ending in '.' should state only the integer part.
Examples:
'10007.76' should return 'Ten thousand and seven point seven six' '001102.34' should return 'One thousand one hundred and two point three four' '.4' should return 'Zero point four' '4.' should return 'Four' '0.' and '.' should return 'Zero' '340,139' should return 'Three hundred and forty thousand one hundred and thirty nine'
In the British short scale notation:
1 Hundred = 10^2 1 Thousand = 10^3 1 Million = 10^6 1 Billion = 10^9 1 Trillion = 10^12 1 Quadrillion = 10^15 1 Quintillion = 10^18 1 Sextillion = 10^21 1 Septillion = 10^24 1 Octillion = 10^27 1 Nonillion = 10^30 1 Decillion = 10^33 1 Vigintillion = 10^63 1 Centillion = 10^303
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers7
Suggested Problems
-
Find the numeric mean of the prime numbers in a matrix.
9177 Solvers
-
24350 Solvers
-
Sum of first n terms of a harmonic progression
525 Solvers
-
Find the area of a rectangle if length of the diagonal is given.
170 Solvers
-
Find Out sum of principal diagonal element of given matrix
259 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
It would be nice if you didn't disallow regular expressions for this kind of problem; text manipulation is exactly what regular expressions are for, after all.