Scans the input string and converts the string according to format string. Use the Scan From String or Scan From File functions when you know the exact format of the input text. Alternatively, you can use the Scan From File function to scan text from a file. The connector pane displays the default data types for this polymorphic function. Details
![]() |
format string specifies how to convert the input string into the output arguments.
The default is to scan the string according to the default format for the data types of the outputs. Right-click the function and select Edit Scan String from the shortcut menu to create and edit the format string.
A space in format string matches any amount of white space, such as spaces, tabs, line feeds, and form feeds. |
||||||
![]() |
input string is the string to scan. | ||||||
![]() |
initial scan location is the offset into the string where the scan begins. The default is 0. | ||||||
![]() |
error in describes error conditions that occur before this VI or function runs.
The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurs before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
| ||||||
![]() |
default 1 specifies the type and default value for the output parameters. If the input value cannot be scanned from the string, the Scan From String function uses the default. If you leave default 1 unwired, the type of the output is determined by format string, if format string is a constant. Otherwise, the default data type is a double-precision floating-point. The default value is zero or an empty string, depending on the output data type. | ||||||
![]() |
remaining string returns the portion of the string that remains after scanning all arguments. | ||||||
![]() |
offset past scan is the offset of input string after completing the scan. | ||||||
![]() |
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces.
Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.
| ||||||
![]() |
output 1..n specifies the output parameters. Each output can be a string path, enumerated type, or any numeric. You cannot use arrays and clusters with this function. |
Increase the number of parameters by right-clicking the function and selecting Add Parameter from the shortcut menu or by resizing the function.
![]() | Note If an error occurs, the source component of the error out cluster contains a string of the form ''Scan From String (arg n),'' where n is the first argument for which the error occurred. |
If you wire a block diagram constant string to format string, LabVIEW checks for errors in format string at compile time. You must correct these errors before you can run the VI. In this case, only Scan failed can occur at run time.
input string | format string | default(s) | output(s) | remaining string |
---|---|---|---|---|
abc, xyz 12.3+56i 7200 | %3s, %s%f%2d | | abc | 00 |
| xyz | |||
0+0i | 12.3+56i | |||
| 72 | |||
Q+1.27E3 tail | Q%f t | | 1.27E3 | ail |
0123456789 | %3d%3d | | 12 | 6789 |
345 | ||||
X:9.860 Z:3.450 | X:%fY:%f | 100 (I32) | 10 | Z: 3450 |
100.0 (DBL) | 100.0 | |||
set49.4.2 | set%d | | 49 | .4.2 |
color: red | color: %s | blue (enum {red, green, blue}) | red | |
abcd012xyz3 | %[a-z]%d %[a-z]%d | | abcd | |
12 | ||||
xyz | ||||
3 | ||||
all your base are belong to us, xyzzy_plugh | %[^,],%s | | all your base are belong to us, | _plugh |
xyzzy |