Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Character Constant Editing

The character constant edit descriptor causes a character string to be output to an external record. It takes one of the following forms:

'string'

"string"

The string is a character literal constant; no kind parameter can be specified. Its length is the number of characters between the delimiters; two consecutive delimiters are counted as one character.

To include an apostrophe in a character constant that is enclosed by apostrophes, place two consecutive apostrophes ('') in the format specification; for example:

50   FORMAT ('TODAY''S^DATE^IS:^',I2,'/',I2,'/',I2)

Note that the symbol ^ represents a nonprinting blank character.

Similarly, to include a quotation mark in a character constant that is enclosed by quotation marks, place two consecutive quotation marks ("") in the format specification.

On input, the character constant edit descriptor transfers length of string characters to the edit descriptor.

Examples

Consider the following '(3I5)' format in the WRITE statement:

 WRITE (10, '(3I5)') I1, I2, I3 

This is equivalent to:

       WRITE (10, 100) I1, I2, I3
 100   FORMAT( 3I5)

The following shows another example:

 !     These WRITE statements both output ABC'DEF
 !     (The leading blank is a carriage-control character).
       WRITE (*, 970)
 970   FORMAT (' ABC''DEF')
       WRITE (*, '('' ABC''''DEF'')')
 !     The following WRITE also outputs ABC'DEF. No carriage-
 !     control character is necessary for list-directed I/O.
       WRITE (*,*) 'ABC''DEF'

Alternatively, if the delimiter is quotation marks, the apostrophe in the character constant ABC'DEF requires no special treatment:

 WRITE (*,*) "ABC'DEF"