STR()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to perform numeric to string conversion

Syntax

STR(<expN1> [,<expN2> [,<expN3> [,<expN4>]]])

See Also

AT(), ATNEXT(), CAST(), INLIST(), INT(), LEFT(), OCCURS(), RAT(), RIGHT(), SET STRESCAPE, STREXTRACT(), STRTRAN(), STRZERO(), STUFF(), SUBSTR(), TRANSFORM(), VAL()

Description

The STR() function converts the numeric expression <expN1> to a right justified character string of width <expN2>, rounded to <expN3> decimal places. If <expN2> is not specified, the string width defaults to 10. If <expN1> is wider than 10 or <expN2>, the STR() function returns a string of asterisks. If <expN3> is not specified, then <expN1> is treated as an integer.

The string conversion can be returned in octal, decimal or hexadecimal when the optional expression <expN4> is specified as 8, 10 or 16, respectively. If <expN4> is not specified, the string is returned in decimal. If hexadecimal is specified then all alpha characters returned are in lower case. This function can be used in index expressions to add numeric and character field types together.

Example

? str(1999.019,8,2)
 1999.02