STRING

The STRING function returns its arguments converted to string type. It is similar to the PRINT procedure, except that its output is placed in a string rather than being output to the terminal. The case in which a single expression of type byte is specified without the FORMAT keyword is special--see the discussion below for details.

Calling Sequence

Result = STRING( Expression 1 , ..., Expression n )

Arguments

Expression n

The expressions to be converted to string type.

Keywords

FORMAT

A format string to be used in formatting the expressions. See Using Explicitly Formatted Input/Output . Note that formatted output from STRING is limited to a maximum of 1024 lines.

PRINT

Set this keyword to specify that any special case processing should be ignored and that STRING should behave exactly as the PRINT procedure would.

Differences Between STRING and PRINT

The behavior of STRING differs from the behavior of the PRINT procedure in the following ways (unless the PRINT keyword is set):

HELP, STRING(INDGEN(5))

gives the result:

<Expression> STRING = Array[5]

while:

HELP, STRING(INDGEN(5), /PRINT)

results in:

<Expression> STRING =' 0 1 2 3 4'

PRINT, STRING([72B, 101B, 108B, 108B, 111B])

produces the output:

Hello

because the argument to STRING, is a byte vector. Its first element is a 72B which is the ASCII code for "H", the second is 101B which is an ASCII "e", and so forth.

Example

To convert the contents of variable A to string type and store the result in the variable B, enter:

B = STRING(A)

See Also

BYTE , COMPLEX , DCOMPLEX , DOUBLE , FIX , FLOAT , LONG , PRINT/PRINTF