dictionary:more:formatnumber
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
dictionary:more:formatnumber [2023/01/09 13:39] – [format number] James Sentman | dictionary:more:formatnumber [2023/01/09 13:46] – [format string spec:] added applescript usage note James Sentman | ||
---|---|---|---|
Line 19: | Line 19: | ||
| - | displays the minus sign to the left of the number if the number is negative, makes no change if the number is positive.| | | - | displays the minus sign to the left of the number if the number is negative, makes no change if the number is positive.| | ||
| E or e | displays the number in scientific notation.| | | E or e | displays the number in scientific notation.| | ||
- | | \character | displays the character that follows the backslash.| | + | | \character | displays the character that follows the backslash. When using with the verb in applescript you will need to double slash this. See applescript usage note below.| |
additionally the string may contain 3 formats separated by semicolons to be used when the number is positive, negative or zero. | additionally the string may contain 3 formats separated by semicolons to be used when the number is positive, negative or zero. | ||
Line 28: | Line 28: | ||
|# | |# | ||
|0000|5|0005| | |0000|5|0005| | ||
+ | |#.#\ \°\F|75.621|75.6 °F| | ||
|# | |# | ||
|###,### | |###,### | ||
Line 36: | Line 37: | ||
|# | |# | ||
|# | |# | ||
+ | |||
+ | **AppleScript Usage Note:** the same backslash character is used to escape values in an applescript string, so to use this in AppleScript you need to double backslash the backslash character. For the example above of formatting a temperature value which is “#.#\ \°\F” would work in the various formatting fields but when using in the **format number** verb in AppleScript you would have to enter it like: | ||
+ | |||
+ | < | ||
+ | write log format number 75.621 format “#.#\\ \\°\\F” | ||
+ | </ |
dictionary/more/formatnumber.txt · Last modified: 2023/02/13 14:52 by 127.0.0.1