Using Format Strings in PPTools
Format strings are a way to control how some of the PPTools display times, dates and numbers. Several of the PPTools add-ins use them, either on the Preferences dialog box or in the PPTools.INI file.
Formatting numbers
Suppose you have a number like 123.
You might want to display it as-is, but you might instead want the number always to occupy five places, padded with leading zeros as need be. That is, you might want it to be 00123. Or you might want it to look like 123.000
The number formats feature allows you to do this.
For example, in ImageExporter, you can control the formating of the number assigned to each exported file:
Click the Preferences button and enter the format you want to use in the Number Format text box.
If you have an older version of ImageExporter and don't want to upgrade for some reason (it's free! why not?):
- Look for the [ImageExporter] section of PPTools.INI (in your PPTools folder)
- If there isn't one there already add a new line like this:
NumberFormat=00000
How to use format strings
0 is a placeholder for any single digit in the original number but if there's no number in that place, a 0 appears instead. If you use a format string of "00000" "1" displays as "00001".
Formatting characters you can use:
Character | Result | Example |
0 | Displays the digit or a zero (that is, it "fills" the number with leading zeros) | 1234 formatted as 000000 becomes 001234 |
# | Displays the digit without leading zeros | 1234 formatted as ###### becomes 1234 |
. | Decimal placeholder; determines how many digits are displayed to left/right of decimal point. | 123.45 formatted as 0000.000 becomes 0123.45 |
% | Displays number as percentage; number is multiplied by 100. The % character appears in the formatted number string. | 1234 formatted as %%% becomes 123% |
- + $ etc | Displays the literal character shown; to display any of the other formatting characters literally, precede them with a backslash (\) or enclose them in double quotes. | 1234 formatted as -$0000.00 becomes $-1234.00 |
"Anything in QUOTES" | Displays the literal text in quotes. | 1234 formatted as "Literal Text -"0000 becomes Literal Text - 1234 |
For complete documentation and examples, look up "User-Defined Numeric Formats" in VBA help.
[Previous] [Home] [Next]