Module:NumberParser/doc
From IdleOn MMO Wiki
This is the documentation page for Module:NumberParser
This module parses numbers expressed in different notations and returns a string representation of the number in standard format. This is a helper module that is intended to be used by other modules, rather than called by templates.
Usage
-- First import the module at the start of your module.
local NumberParser = require('Module:NumberParser')
-- Call the parse function with your input.
local input = '5e6'
local output = NumberParser.parse(input)
Supported Notations
Notation | Examples | Notes |
---|---|---|
Standard Notation | 5 , 37 , 1000000000
|
|
Exponential Notation | 3e17 , 2.5e+5 , 7.e15 , .8e+22
|
|
Unit Notation | 14K , 3M , 1.5Q
|
|
Supported Units
- K: 1,000
- M: 1,000,000
- B: 1,000,000,000
- T: 1,000,000,000,000
- Q: 1,000,000,000,000,000
Invalid Numbers
Negative numbers and decimal numbers are not supported.