User:QuickNick/FormatNumDP4

Script to nicely format and round numbers to N decimal places.

Note: This is functionally similar to User:QuickNick/FormatNumDP2 but you can use the |Num= syntax or just enter the number as the first/only (unnamed) parameter. The other change is that it didn't like the unnamed parameter having leading spaces so I added a command to remove spaces   and it worked! For the sake of consistency I have now made the same change to User:QuickNick/FormatNumDP2 and User:QuickNick/FormatNumDP.

Syntax:

DP is Number of Decimal Places and if not set it will default to 0.

This is the relevant part of the script with carriage-returns to make it easier to read!

Some examples ...

100kph = mph 100kph = mph The number can be (un)formatted so

is the same as

The number can be (un)formatted so is the same as