Next: Character Assignment Statements
Up: Character Handling and Logic
Previous: Substring Rules
The character operator // is used to concatenate, or join, two
character strings. It is, in fact, the only character operator that
Fortran provides. Thus:
'CUP' // 'BOARD' 'CUPBOARD'
The length of the result is just the sum of the lengths of the
operands. Parentheses may be used in character expressions but
make no difference to the result. Note that any embedded or
trailing blanks (spaces) will be reproduced exactly in the resulting
string.
The general form of a character-expression is thus:
character-operand
or
character-expression //
character-operand
where character-operand can be any of the following:
- character constant (literal or named),
- character variable,
- character array element,
- character substring,
- character function reference.
There is one special restriction on character concatenation in
procedures: a passed-length dummy argument can only be an
operand of the concatenation operator in an assignment statement.
This seemingly arbitrary rule allows the compiler to determine how
much work-space is required.
Helen Rowlands
8/27/1998