This is a number converter, it convers diffrent types of numbers to arabic.
- Roman to Arabian
- For the moment maximum number conversion it supports is 3888.
Name | Location | Use |
---|---|---|
RAvalue | RA() | This is HTML input |
validNum | RAhub | Checks if all inputs characters are valid |
roman | RAconvert | Contains string which is used to find match to input |
unique | RAcheck | Used to make sure that strings dosen't contain invalid roman numbers |
numbers | RAconvert | Pushes the corrosponding number match from string to array and sums it |
type | returns | If valid is "false" this says the error |
occurence | returns | Used to count how many times a invalid number was met |
valid | returns | This says if input is "true"/"false" |
letter | returns | This is invalid letter |
letter1 | returns | This is invalid letter |
letter2 | returns | This is invalid letter |
Name | From function |
---|---|
check | RAhub |
valid | RAcheck |
result | RAconvert |
pos | RApos |
Type | When occures | HTML message |
---|---|---|
LError | When it meets a invalid letter | Your input has "+check.occurence+" characters that do not match roman numbers |
NError | When input string contains numbers | Your input includes arabian numbers |
CError1 | When too many of characters exists | You can't have number " +check.letter+ ", " +check.occurence+ " times." |
CError2 | When 2 numbers exists which can't exist at the same time | You can't have number " +check.letter1+ " and number " +check.letter2+ " at the same time. |
CError3 | When number exists after which another number can't exists over 1 time | You can't have number " +check.letter1+ " over one time, when number " +check.letter2+ " exists. |
javascript function RA()
- This is start function
- Actions
- Prints/Takes info to/from HTML
- makes input upper casse
- Starts console.time
- Starts
javascript function RAhub(RAvalue)
javascript function RAhub(RAvalue)
- This is center of functions
- Actions
- checks for numbers
- If no numbers are met it continues
- If number is met it returns
- starts
javascript function RAcheck(RAvalue)
- Checks that there aren't too many roman umbers in case
- If function returns "valid" it continues
- IF function returns "false" it returns, type: CError
- starts
javascript function RAconvert(RAvalue)
- It converts the roman numbers to arabic numbers and sums it up
- This function will return the converted number
- starts
javascript function RApos(result.numberArray)
- Checks that numbers are in right order
- If function returns "valid" it returns
- IF function returns "false" it returns, type: PosError
- checks for numbers