Skip to content

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

ModifierInterpretation
widthMaximum number of characters to read.
delimiterThe 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
qThe string is expected to be read with surrounding single-quotes (') or double-quotes ("). Whitespace and delimiter characters enclosed in quotes are preserved.
QSame as q modifier except that the surrounding quotes are stripped before copying to the output parameter.
Parameter TagData 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