The following table displays the syntax elements for format specifiers. Refer to the examples of format specifiers for more information.
| Syntax Element | Description | |||
|---|---|---|---|---|
| % | Begins the format specifier. | |||
| $ (optional) | When you use a formatting function, this modifier specifies the order in which to display variables. Include the digit that represents the order of the variable immediately before this modifier. | |||
| - (optional) | When you use a formatting function, this modifier left justifies the parameter rather than right justifies it within its width. | |||
| + (optional) | When you use a formatting function, this modifier includes sign even when the number is positive. | |||
| ^ (optional) | When you use a formatting function and the e or g conversion codes, this element formats the number in engineering notation, where the exponent is always a multiple of three. | |||
| # (optional) | When you use a formatting function, this modifier removes trailing zeros. If the number has no fractional part, this modifier also removes the description part. | |||
| 0 (optional) | When you use a formatting function, use this modifier without the - modifier to pad any excess space to the left of a numeric parameter with zeros rather than with spaces to reach minimum width. | |||
| Width (optional) | When you use a scanning function, such as Scan From String, the Width element specifies an exact field width to use. LabVIEW scans only the specified number of characters when processing the parameter. When you use a formatting function, the Width element specifies the minimum character field width of the output. This width is not a maximum width. LabVIEW uses as many characters as necessary to format the parameter without truncating it. LabVIEW pads the field to the left or right of the parameter with spaces, depending on justification. If Width is missing or 0, the output is only as long as necessary to contain the converted input parameter. | |||
| .Precision or _Significant Digits (optional) | When you use a formatting function, . or _ controls the number of digits displayed. If you use ., LabVIEW uses the number that follows as a precision specifier for digits to the right of the decimal point. If you use _, LabVIEW uses the number that follows as the specified number of significant digits to use in the display format. .Precision—When you use it with floating-point notation, this element specifies the number of digits to the right of the decimal point. If . is not present, LabVIEW uses a precision of six digits. If . is 0, LabVIEW does not insert a precision. When you use it with string parameters, .Precision specifies the maximum width of the scanned field. LabVIEW truncates strings longer than this length. _Significant Digits—Displays the data by rounding to the number of digits you specify. LabVIEW rounds the data only for display purposes, which does not affect the original data. .Precision affects only the digits to the right of the decimal point, and _Significant Digits includes all non-spacing digits. For example,
| |||
| {Unit} (optional) | Overrides the original unit of a VI when you use a function to convert a physical quantity (a value with an associated unit). You must use a compatible unit. You can use this syntax element only with the Format Into String function. | |||
| <Embedded Format Information> | Contains a time-specific format string. Refer to the Format Codes for the Time Format String for valid format strings. Only %W, %D, %H, %M, %S and %u apply to relative time. | |||
| Conversion Codes | Characters that specify how to scan or format a parameter. | |||
Use the following conversion codes for integers and fixed-point numbers:
| ||||
Use the following conversion codes for floating-point and fixed-point numbers:
| ||||
Use the following conversion codes for a string:
| ||||
Use the following conversion codes for time:
| ||||
| Localization Codes | Determines if LabVIEW uses a decimal or comma to separate the whole number from the decimal part of the number. These codes control the decimal separator for numeric output. These codes do not cause any input or output to occur. They change the decimal separator for all further inputs and outputs until they find the next %;. | |||
| %,; | Comma decimal separator. | |||
| %.; | Period decimal separator. | |||
| %; | System default separator. | |||