Click or drag to resize

Formatting String Output Parameters

Strings used as output parameters from method and property responses can be formatted in a variety of ways. This topic explains the formatting options available for scalar parameters as well for string arrays.

Strings used as output parameters have format specifications of the following general form:

%[width] [delimiter] [q | Q] s

Modifier

Interpretation

width

Maximum number of characters to read.

delimiter

The parameter must be an array of strings. The instrument response is interpreted as a delimited list of strings, where delimiter specifies the delimiter character.

The following delimiters are supported. Note that the enclosing parentheses are not required for comma-separated lists:

  • , or (,) - comma-separated list

  • (;) - semicolon-separated list

  • (:) - colon-separated list

  • (s) - space-separated list

  • (t) - tab-separated list

  • (r) - carriage return-separated list

  • (n) - linefeed-separated list

q

The string is expected to be read with surrounding single-quotes (') or double-quotes ("). Whitespace and delimiter characters enclosed in quotes are preserved.

Q

Same as q modifier except that the surrounding quotes are stripped before copying to the output parameter.

Example: Output String Parameter

Parameter Tag

Data Expected from Device

{Name:%s}

Data from device:

Hello World

Data copied to output parameter:

Hello World

{Name:%qs}

Data from device:

'Hello World'

Data copied to output parameter:

'Hello World'

{Name:%Qs}

Data from device:

"Hello World"

Data copied to output parameter:

Hello World

{NamesArray:%,Qs}

Data from device:

"one",'two',"three",'four'

Data copied to output parameter:

NamesArray[0]: one

NamesArray[1]: two

NamesArray[2]: three

NamesArray[3]: four

See Also

Download a complete CHM version of this documentation here.