@num.format
Format a number with decimal places (like formatUnits).
Returns: string
Syntax
Section titled “Syntax”@num.format(value decimals)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
value |
number |
Input value |
decimals |
number |
Number of decimal places |
Examples
Section titled “Examples”# Format wei to ETH (18 decimals)set $eth @num.format(1500000000000000000 18)
# Format USDC (6 decimals)set $usd @num.format(1500000 6)See Also
Section titled “See Also”- @num.parse — inverse: parse a decimal string
- @token.amount — token-aware unit conversion