String variables are used to store values of string types (i.e. variable length sequences of characters). The maximum number of characters allowed in each sequence is fixed and is defined when the string type is defined. The individual characters in a string can be referenced using a similiar syntax to the that used to reference individual array elements.
For example if name is a string variable containing the string 'Bob' then
name[1] accesses the first character in the string (i.e. 'B')
and
name[2] accesses the second character in the string (i.e. 'o')
The + operator can be used to perform string concatenation (i.e. joining).
For example here is a hello world program using string concatenation.
program good(output);
begin
writeln('hello' + ' ' + 'world' + '!')
end.
The syntax for accessing individual elements in a string is given below:
(NOTE: for clarity some parts of the syntax are omitted, see Irie Pascal Grammar for the full syntax):
indexed-variable-string = string-variable '[' integral-expression ']'
integral-expression = expression
string-variable = variable-access
where string-variable is a reference to a string variable, and integral-expression is an expression which evaluates to the position of the string element being accessed.