$toalpha

$toalpha

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

$toalpha

Converts an expression to the alpha data type and sets the length of the result.

Syntax

$toalpha(expression,length)

Parameters

expressionAny value, or an expression that yields any value.
lengthA 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

$left

$substring

$tochr

$tonumber

$toord

About Character Literals

About Functional Expressions

Conversion Between Data Types

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

pt_BRPortuguese