String format
Only # 0 and . characters can be used.
for decimal values and two’s complement value, characters have the following meaning:
Format character | Description |
---|---|
0 Digit placeholder | Display a digit or a zero. If the expression has a digit in the position where the 0 appears in the format string, display it; otherwise, display a zero in that position. If the number has fewer digits than there are zeros (on either side of the decimal) in the format expression, display leading or trailing zeros. If the number has more digits to the right of the decimal separator than there are zeros to the right of the decimal separator in the format expression, round the number to as many decimal places as there are zeros. If the number has more digits to the left of the decimal separator than there are zeros to the left of the decimal separator in the format expression, display the extra digits without modification. |
# Digit placeholder | Display a digit or nothing. If the expression has a digit in the position where the # appears in the format string, display it; otherwise, display nothing in that position. This symbol works like the 0 digit placeholder, except that leading and trailing zeros aren’t displayed if the number has the same or fewer digits than there are # characters on either side of the decimal separator in the format expression. |
. Decimal placeholder | The decimal placeholder determines how many digits are displayed to the left and right of the decimal separator. If the format expression contains only number signs to the left of this symbol, numbers smaller than 1 begin with a decimal separator. If you always want a leading zero displayed with fractional numbers, use 0 as the first digit placeholder to the left of the decimal separator instead. |
Examples of different format strings applied to 1234.5 value.
number 1234.5, format: 00000.00, result: 01234.50
number 1234.5, format: #####.##, result 1234.5
number 1234.51111, format: #.#, result 1234.5
ECT uses the total number of placeholders to resize the box that shows the value. If you want to be sure the number is completely displayed, you have to add extra # placeholders in the left.
For hexadecimal, binary and text srepresentations, charactershave the following meaning:
-
Each symbol # or 0 is a placeholder for a character and is only meant to give the sw a criterion for sizing the width of the box that contains the value. In many cases the construction of the string format for these types of representation is automatic.
-
The symbol dot (.) has no meaning.