$toalpha
$toalpha
Converts an expression to the alpha data type and sets the length of the result.
Syntax
$toalpha(expression,length)
Parameters
expression | Any value, or an expression that yields any value. |
length | A number. Can be a constant, a variable, a parameter, a menu item, or a form field. |
Return Value
Character string (alpha), length bytes long.
Comments
Use $toalpha to convert expression to the alpha data type in an area length bytes long. If length is negative, the result string is set to the maximum possible length. If length is zero, the result is the null string.
String comparisons involving this function are case-insensitive.
If expression is a number, the number is converted to character string form in an area length bytes long. If the given area is not large enough to hold the converted value, an error results.
Example
Assume that LastName is “Smith “.
$toalpha(LastName,3)
Evaluates to “Smi”.
$toalpha(LastName,12)
Evaluates to “Smith “.
$toalpha(50,2)
Evaluates to “50”.
$toalpha(20+30,19)
Evaluates to ” 50″ (17 leading spaces).
$toalpha(200+300,20)
Evaluates to ” 500″ (17 leading spaces).
$toalpha(500,-2)
Evaluates to ” 500″ (14 leading spaces).
list all Emps format $toalpha(FirstName,6), $toalpha(LastName,9)
Alters the width of values being output with a LIST command.
See Also