Beta
English words to numbers (Part II)
14osofem
Description:
This is the Part II of English words to numbers (my very first kata on CodeWars ☺). But this time we shall support up to "Nine hundred and ninety-nine vigintillion" 999x1063
(Check Names of large numbers for names of large numbers with their corresponding value). We shall be returning strings or NaN
if the input doesn't evaluate to a valid number.
NOTE: we are using short scale i.e million is 106 and billion is 109.
Rules
- Empty string should return "0"
- Should support up to
± 999x1063
- A string equivalent of the word passed is returned e.g "one" =>
"1"
- No trailing zeros i.e. zero point zero zero one zero =>
"0.001"
NOT"0.0010"
- If word starts with negative, "-" should be added to the string E.g. "negative five" =>
"-5"
- Should work with decimals. E.g. "negative twenty three point two three seven" =>
"-23.237"
- Any word that does not evaluate to a number should return
NaN
E.g. "thirty point ninteen" =>NaN
. (i.e. It should have been thirty point one nine) - Words like one million three billion should return
NaN
(billion doesn't come after million). - Words between 21 and 99 might be hypened E.g. twenty-one, fifty-seven, etc
Fundamentals
Strings
Similar Kata:
Stats:
Created | May 16, 2017 |
Published | May 17, 2017 |
Warriors Trained | 65 |
Total Skips | 0 |
Total Code Submissions | 315 |
Total Times Completed | 14 |
JavaScript Completions | 14 |
Total Stars | 6 |
% of votes with a positive feedback rating | 63% of 4 |
Total "Very Satisfied" Votes | 2 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 4 |
Average Assessed Rank | 3 kyu |
Highest Assessed Rank | 2 kyu |
Lowest Assessed Rank | 4 kyu |