String Table Resources
String tables are resources (embedded configuration data) edited with WorkBench.
- A string table is a list of items identified by a name and referring to one or more character strings.
- String tables are typically used for defining static texts to be used in the application.
- These functions can be used for getting access to string tables in the programs:
- StringTable: selects the active string table.
- LoadString: Load a string from the active table.
- Each string table may contain several columns of texts for each item, and thus ease the localization of application, simply by defining a column for each language.
- This way, the language can be selected dynamically at runtime by specifying the active language (as a column) in the StringTable() function.
The name entered in the string table as an ID is automatically declared for the compiler.
- The name:
- Can directly be passed to the LoadString() function without re-declaring it.
- Must conform to IEC standard naming rules.
You could do the same by declaring an array of STRING variables and enter some initial values for all items in the array.
- String tables provide significant advantages compared to arrays:
- The editor provides a comfortable view of multiple columns at editing.
- String tables are loaded in the application code and does not require any further RAM memory unlike declared arrays.
- The string table editor automatically declares readable IDs for any string item to be used in programs instead of working with hard-coded index values.
If the text is too long for the STRING variable when used at runtime, it is truncated.
Use special $ sequences in strings to specify non printable characters, according to the IEC standard:
|
Code |
Meaning |
|---|---|
|
$' |
A Single quote. |
|
$$ |
A "$" character. |
|
$L |
A line feed character (ASCII code 10). |
|
$N |
Carriage return plus line feed characters (ASCII codes 13 and 10). |
|
$P |
A page break character (ASCII code 12). |
|
$R |
A carriage return character (ASCII code 13). |
|
$T |
A tab stop (ASCII code 9). |
|
$xx |
Any character (xx is the ASCII code expressed on two hexadecimal digits. |




