Character % is used for listing the values of control variables. Chars following the % define the format of listing:
Data type | Char | Note | Example |
---|---|---|---|
Boolean | 'u' | %u | |
Byte | 'u' | %u | |
Integer | 'd' | decimal notation (e.g. "254", "-56" ..) | %d, %5d, %05d |
Integer | 'x' | hexadecimal notation (e.g. "E5F") | %x, %4x, %04x |
Long | 'ld' | %ld, %7ld, %07d | |
Single | 'e' 'f' | is shown in the form: [-]d.ddde[+-]dd is shown in the form: [-]dddd.ddd | %e %f, %3.4f |
Double | 'le' 'lf' | is shown in the form: [-]d.ddde[+-]dd is shown in the form: [-]dddd.ddd | %le %lf, %4.7lf |
String | 's' | %s |
This extended syntax can be used only when calling the following methods Pm.StringFormat and Pm.StringScan.
Sequence | Char | ASCII meaning (see The ASCII table) |
---|---|---|
\\ | Char "\" | Backslash |
\a | Char with code &H07 | BEL |
\b | Char with code &H08 | BS - Backspace |
\f | Char with code &H0c | FF - Formfeed |
\n | Char with code &H0a | LF, NL - Linefeed, New Line |
\r | Char with code &H0d | CR - Carriage return |
\t | Char with code &H09 | HT - Tab, Horizontal Tabulator |
\v | Char with code &H0b | VT - Vertical Tabulator |
\xh | Char with code &Hh | |
\xhh | Char with code &Hhh |
Temperature=%5d ... Power=%5.2f
and the leading variable (Temperature, the value 98) is of the Integer type, the next variable (Power, the value 34.2345) is of the Single type.
The output text will be in the form:
Temperature= 98 ... Power=34.23
var str = Pm.StringFormat("New line \n char 18hexa: \x18", 1);
Dim str
str = "New line " & Chr(&H0a) & " char 18hexa: " & Chr(&H18)
var i = 1;
Pm.Debug(Pm.StringFormat("Value:%i", i));