Format |
Strings | |
Aptilis 1 |
Format(PadCharacter, mBefore, nAfter, value)
Format, as its name implies, will format a number into a
string containing at least nBefore characters on the left
of the decimal point and exactly After characters after
the decimal point.
You can specify a padding character to be used on the left
of the decimal point, you will usually want a space or zero.
- If the pad string is empty then nFormat will be likely
to fail in putting at least nBefore characters before the decimal
dot.
- If the number is so great that it cannot fit in nBefore characters,
it will NOT be truncated, and you will not get what you expected.
- If the pad string contains more than one character, only the first
one will be used.
Return Value:
A formatted string containing a number.
Example:
print(Format("0", 4, 2, 0), "\n") print(Format("0", 3, 1, 1.5), "\n") print(Format("x", 3, 1, -1.5), "\n") print(Format("0", 1, 1, -1.5), "\n") print(Format(" ", 2, 1, 1.59), "\n") print(Format(" ", 2, 1, -1.49), "\n") print(Format(" ", 1, 3, 1.49), "\n") print(Format("0", 3, 0, 1.5), "\n") print(Format(" ", 2, 2, 1998), "\n")Result:
0000.00 001.5 -x1.5 -1.5 1.6 -1.5 1.490 001 1998.00 |