Factry Historian
...
Scripting
Formatting
formatting the format 'verbs' are derived from go's but are simpler the verbs general boolean integer float string and bytes default format for %v compound objects width and precision width is specified by an optional decimal number immediately preceding the verb if absent, the width is whatever is necessary to represent the value precision is specified after the (optional) width by a period followed by a decimal number if no period is present, a default precision is used a period with no following number specifies a precision of zero examples width and precision are measured in units of unicode code points either or both of the flags may be replaced with the character ' ', causing their values to be obtained from the next operand (preceding the one to format), which must be of type int for most values, width is the minimum number of runes to output, padding the formatted form with spaces if necessary for strings and bytes, however, precision limits the length of the input to be formatted (not the size of the output), truncating if necessary normally it is measured in units of unicode code points, but for these types when formatted with the %x or %x format it is measured in bytes for floating point values, width sets the minimum width of the field and precision sets the number of places after the decimal, if appropriate, except that for %g/%g precision sets the maximum number of significant digits (trailing zeros are removed) for example, given 12 345 the format %6 3f prints 12 345 while % 3g prints 12 3 the default precision for %e, %f and %#g is 6; for %g it is the smallest number of digits necessary to identify the value uniquely for complex numbers, the width and precision apply to the two components independently and the result is parenthesized, so %f applied to 1 2+3 4i produces (1 200000+3 400000i) other flags flags are ignored by verbs that do not expect them for example there is no alternate decimal format, so %#d and %d behave identically