Cicode Programming Reference > Using Cicode Programming Standards > Format Templates

Format Templates

The format of a format template string

[text]{<name>[,width[,justification]]}[text]...

Rules for valid format template display

  1. If the "width" value is not present then the width is set to the length of the number of characters inclusive between '{' and '}'. This means that the field value may be truncated or padded depending on the name value length.
  2. If the "width" value is specified then that is the length of the field. This means that the name value length may be truncated or padded.
  3. The justification is made up of a single character with the following behaviours as specified:
  4. If a justification is not specified then the name value is assumed to be left justified.
  5. Any spaces appearing after the first comma onwards in the format template will be stripped out at no penalty to the user.

Malformed format template display

There are two types of malformed templates and below are examples of each and the resulting output.

Internal malformation
This is when there is a correct open and close bracer '{' and '}' but inside the format template there is a malformation. For example there may be a space not a comma separating the name and the width. In this case the whole field is ignored which means nothing between and including '{' and '}' is displayed.

For example:

Take the following string

< { LocalTimeDate , 20 , R } > TagLabel < { Tag , 20  L } > DescriptionLabel < {
Desc , 20 , L } >

The output would as follows:

<  2009-07-17 11:13:17 > TagLabel <  > DescriptionLabel < ValidAlarm1Desc	>

Note: The "Tag" name value is not outputted as the field has no ',' between the width and justification.

Bracer malformation

This is when there is an open bracer '{' but no closing bracer '}'. In this case the malformation is printed as a string literal.

For example:

Take the following string:

< { LocalTimeDate , 20 , R } > TagLabel < { Tag , 20 , L  > DescriptionLabel < {
Desc , 20 , L } >

The output would be as follows:

<  2009-07-17 11:31:44 > TagLabel < { Tag , 20 , L  > DescriptionLabel <
ValidAlarm1Desc	>

Note: The "Tag" name value is outputted as a literal as no closing bracer '}' is detected.

Cicode Functions