Text Expression
Text expressions are used in the explanation field, question field and in text rules of a parameter declaration. In sections text expressions are used as advice.
Text expressions can be a mixture of strings and the values of some parameters and text functions. Using the name of a parameter causes the value of that parameter to be displayed as part of the compound text. The & character can be used to insert new lines in the text. The syntax for a text expression is:
<text-expression> ::= <simple-text> { <text-expression> }
<simple-text> ::= <string> | <parameter-name> | & |
<text-function>( <argumentlist> )
<text-function> ::= concat | startstr | endstr
<argumentlist> ::= <argument> {, <argumentlist> }
<argument> ::= <text-expression>
The text functions are:
concat(X,Y) returns the string X concatenated with Y
startstr(N,X) returns the first N characters from the string X
endstr(N,X) returns the last N characters from the string X
Examples
'this text' & 'will be displayed on' & 'three seperate lines'
The following example uses three strings and the value of two parameters - animal and favourite_food:
'The favourite food of the ' animal ' is ' favourite_food '.'
The resulting display on the screen might be:
The favourite food of the koala is eucalyptus leaves.
The following test will only accept those days of the week starting with a 't', i.e. tuesday or thursday:
startstr(1,name_of_day) = 't'