Format Into String
- Updated2025-03-14
- 4 minute(s) read
Formats string, path, enumerated type, time stamp, Boolean, or numeric data as text.
You can use the Format Into String function to convert a number into a string. To format data as text and write the text to a file, use the Format Into File function instead.

Inputs/Outputs
![]() format string specifies how you want the function to convert the input arguments into resulting string. Defaults match the data type of the input arguments. Right-click the function and select Edit Format String from the shortcut menu to create and edit the format string. Use special escape codes to insert non-displayable characters, the backslash, and the percent characters.Note This function interprets backslashes as escape characters. To use a literal backslash in format string, you must enter \\.
![]() initial string specifies the base string to which you can append any arguments to form the resulting string. ![]() error in describes error conditions that occur before this node runs. This input provides standard error in functionality. ![]() ![]() resulting string contains the concatenation of initial string and the formatted output. ![]() error out contains error information. This output provides standard error out functionality. |
To increase the number of parameters, right-click input 1 and select Add Parameter from the shortcut menu or resize the function.
If you wire a block diagram constant string to format string, LabVIEW uses format string to determine the number of outputs and the data type of each output at compile time. If the data types you wire to the outputs do not match the data types determined by format string, you must change the output data types before the VI can run.
Specifying Which Input to Use within the Format String
By default, this function uses the order of the inputs to populate the format specifiers, or percent codes in the Format String. However, you can use a number followed by a dollar sign ($) within a percent code to specify exactly which input to use for that percent code. For example, the percent code %3$d uses the third input regardless of how many percent codes appear before %3$d in the format string.
Refer to the following block diagram and table for an example of how to use format specifiers:

The following input combinations illustrate the effects of the $ specifier in the previous block diagram:
Input 1 | Input 2 | Format String | Return String | Comments |
---|---|---|---|---|
first | second | %s %s | first second | Format String does not use the $ specifier, so the function populates the percent codes in input order. |
first | second | %2$s %1$s | second first | Format String uses the $ specifier to display the inputs in a different order than their input order. |
first | second | %1$s %1$s %1$s | first first first | Format String uses the $ specifier to display the first input multiple times and ignore the second input. |
You can use other special characters besides the $ to configure how this function populates the percent codes in format string.
Examples
Refer to the following example files included with LabVIEW.
- labview\examples\File IO\Spreadsheet\Tab-Delimited Data\Buffered Stream to Tab-Delimited Text File.vi