## 2.3.2 Character Expressions

Character expressions consist of character elements and character operators. The evaluation of a character expression yields a single value with a character data type. Character expressions take the following form:

    character-element [//character-element] . . .

character-element
  Is any one of the following entities:

  - Character scalar reference

  - Character substring

  - Character expression, optionally enclosed in parentheses

  - Character function reference

The only character operator is the concatenation operator (//).

The value of a character expression is a character string formed by successive left-to-right concatenations of the values of the elements of the character expression. The length of a character expression is the sum of the lengths of the character elements. For example, the value of the character expression `'AB'/ /'CDE'` is `'ABCDE'`, which has a length of five.

Parentheses do not affect the value of a character expression; for example, the following character expressions are equivalent:

    ('ABC'//'DE')//'F'

    'ABC'//('DE'//'F')

    'ABC'//'DE'//'F'

Each of these character expressions has the value `'`ABCDEF`'`.

If a character element in a character expression contains spaces, the spaces are included in the value of the character expression. For example:

`'ABC '//'D E'//'F '` has a value of `'ABC D EF '`

Previous Page Next Page Table of Contents