String Format

If the Format property begins with a percent sign (%), and is defined as %[-]w.ps . The formatting codes are defined as:

Property

Description

“-”

This is an optional formatting code used for left justification. If you want the string to be right justified, do not enter a “-”.

“w”

This specifies the length of the argument. For example, if you entered “9”, and the argument is 8 characters long, the string will be padded with a space to reach the width of 9 characters.

If you entered “9”, and the argument is 10 characters, the argument will be truncated at 9 characters.

“p”

This specifies the precision in decimal points.

Note! Either the “w” or “p” can be omitted, but the period must prefix the “p”.

“s”

Each % string must end with the letter “s”. The letter “s” indicates that the numbers are a string.

The default format is to right-justify the result by adding spaces in front of the value, but if the format specifier contains a left-justification indicator (a “-” character preceding the width specifier), the result is left-justified by adding spaces after the value.

String Format example:

String: Testing

Format: %4s

Variable: F1

F1 = “Test”