numberformatter
Library for formatting numbers
_VERSION = "1.1.0" | "Metadata" - Version |
---|---|
_DESCRIPTION = "Library for formatting numbers" | "Metadata" - Description |
_URL | "Metadata" - Homepage / Url |
_LICENSE = "GPL-3.0" | "Metadata" - License |
compact(number) | Format number by LDML's specification for Compact Number Formats |
abbreviate(number) | Format number - separate thousands by comma |
- _VERSION = "1.1.0"
"Metadata" - Version
- _DESCRIPTION = "Library for formatting numbers"
"Metadata" - Description
- _URL:
string
"Metadata" - Homepage / Url
- _LICENSE = "GPL-3.0"
"Metadata" - License
- compact(number)
Format number by LDML's specification for Compact Number Formats
Parameters
- number
number
The number to format
Returns
string
formatted number
Usage
Example:
local numberformatter = require("numberformatter") print(numberformatter.compact(1000))
Output:
1k
- number
- abbreviate(number)
Format number - separate thousands by comma
Parameters
- number
number
The number to format
Returns
string
formatted number
Usage
Example:
local numberformatter = require("numberformatter") print(numberformatter.abbreviate(1000))
Output:
1,000
- number