Format conversion characters – Teledyne LeCroy Merlins Wand - CSL manual (CATC Scripting Language Manual) User Manual

Page 38

Advertising
background image

32

CATC Scripting Language for Bluetooth Analyzers

CATC

Manual Ver. 1.21

Comments

Format

is used to control the way that arguments will print out. The format string

may contain conversion specifications that affect the way in which the arguments
in the value string are returned. Format conversion characters, flag characters, and
field width modifiers are used to define the conversion specifications.

Example

Format("0x%02X", 20);

would yield the string

0x14

.

Format

can only handle one value at a time, so

Format("%d %d", 20, 30);

would not work properly. Furthermore, types that do not match what is specified in
the format string will yield unpredictable results.

Format Conversion Characters

These are the format conversion characters used in CSL:

A conversion specification begins with a percent sign (%) and ends with a conver-
sion character. The following optional items can be included, in order, between the
% and the conversion character to further control argument formatting:

Flag characters are used to further specify the formatting. There are five flag characters:

A minus sign (

-

) will cause an argument to be left-aligned in its field. Without the

minus sign, the default position of the argument is right-aligned.

A plus sign will insert a plus sign (

+

) before a positive signed integer. This only works

with the conversion characters

d

and

i

.

A space will insert a space before a positive signed integer. This only works with the
conversion characters

d

and

i

. If both a space and a plus sign are used, the space flag

will be ignored.

Code

Type

Output

c

Integer

Character

d

Integer

Signed decimal integer.

i

Integer

Signed decimal integer

o

Integer

Unsigned octal integer

u

Integer

Unsigned decimal integer

x

Integer

Unsigned hexadecimal integer, using "abcdef."

X

Integer

Unsigned hexadecimal integer, using "ABCDEF."

s

String

String

Table 11.1: Format Conversion Characters

Advertising