FTOA: Converting a Number to Alphanumeric Format

How to:

The FTOA function converts a number up to 16 digits long from numeric format to alphanumeric format. It retains the decimal positions of the number and right-justifies it with leading spaces. You can also add edit options to a number converted by FTOA.

When using FTOA to convert a number containing decimals to a character string, you must specify an alphanumeric format large enough to accommodate both the integer and decimal portions of the number. For example, a D12.2 format is converted to A14. If the output format is not large enough, decimals are truncated.


Top of page

x
Syntax: How to Convert a Number to Alphanumeric Format
FTOA(number, '(format)', output)

where:

number

Numeric F or D (single and double precision floating-point)

Is the number to be converted.

format

Alphanumeric

Is the format of the number to be converted enclosed in parentheses. Only floating point single-precision and double-precision formats are supported. Include any edit options that you want to appear in the output. The D (floating-point double-precision) format automatically supplies commas.

output

Alphanumeric

The length of this argument must be greater than the length of number and must account for edit options and a possible negative sign.



Example: Converting From Numeric to Alphanumeric Format

FTOA converts GROSS from floating point double-precision to alphanumeric format.

FTOA(GROSS, '(D12.2)', 'A15')

For $1,815.00, the result is 1,815.00.

For $2,255.00, the result is 2,255.00.


iWay Software