OpenDX - Documentation
Full Contents QuickStart Guide User's Guide User's Reference
Previous Page Next Page Table of Contents Partial Table of Contents Index Search

Parse

Category

Annotation

Function

Extracts values from an input string.

Syntax


value, ... = Parse(input, format);

Inputs
Name Type Default Description
input string none string to be operated on
format string "%s" format control string

Outputs
Name Type Description
value value or string value extracted from input string
... value or string additional values extracted

Functional Details

This module uses a format-control string (format) to extract values from a specified input string (input).

Note: The control string resembles a C-language scanf format string.

The "%" symbol in the control string specifies that extraction is to begin at the corresponding position in the input string. The character immediately following this symbol specifies the type of value to be extracted:

c: single character
d: integer
f: floating point (with a fixed number of digits after the decimal point)
g: general (scientific notation if appropriate)
s: string.

The number of outputs is equal to the number of extractions specified in format.

Example

Given the statements:

string = "temperature = 45.8  index = 4 color = red"
format = "temperature = %f index = %d color = %s"
output1, output2, output3 = Format(string, format);
the three outputs of parse will be 45.8, 4, and "red."

Example Visual Program

UsingParse.net

See Also

 Format


Full Contents QuickStart Guide User's Guide User's Reference

[ OpenDX Home at IBM | OpenDX.org ]