DADiSP Worksheet Functions > Function Categories > Data Type Conversion > CASTSTRING

 

CASTSTRING

Purpose:

Explicitly casts the input to a string.

Syntax:

CASTSTRING(val)

val

-

A scalar, series or table.

Returns:

A string.

Example:

caststring(8)

 

returns the string: 8

Example:

caststring(2+3i) + " hello"

 

returns the string: 2.0000 + 3.0000i hello

Example:

W1: gsin(100,.01)

caststring(max(W1))

 

returns the string: 1

 

W1: {68, 65, 68, 105, 83, 80}

caststring(W1)

 

returns the string: DADiSP

Remarks:

CASTSTRING is helpful when writing SPL functions that require an explicit string input and the type of the variable passed into the function may not be a string.

 

When used with integer input, CASTSTRING functions like STRCHARS.

 

When used with table input, CASTSTRING operates on the first column of the table.

See Also:

CASTCOMPLEX

CASTINTEGER

CASTREAL

CASTSERIES

CASTWINDOW

SPRINTF

STRCHAR, STRCHARS

STRNUM