The LeftAlign built-in variable method removes leading zeros from the numeric expression and moves the result, left-aligned, and without separators, to the calling variable. Trailing decimal zeros are not removed. If the calling variable is not sufficiently long, the value is truncated on the right.
Moving non-zero values
If the value of the alignThis parameter is non-zero:
The setZero parameter is ignored.
If the value of the alignThis parameter is signed and has a negative value, a leading minus sign is output.
The Decimals property of the alignThis parameter determines the number of decimal digits output. Trailing zeros are not removed.
A decimal point character is output before any decimal digits.
Syntax
<<string variable>>::LeftAlign( alignThis : numericExpression, setZero : boolean = false, decimalChar : string = void ) : void
Owner
Any string variable.
Parameters
alignThis
The numeric expression to be left-aligned.
setZero
True sets the calling variable to zero, rather than spaces, if the value to be aligned is zero.
If the decimalChar parameter is not specified, the calling variable is set to a single left-aligned zero. If the decimalChar parameter is specified, the calling variable is set to that specified, followed by the number of zeros specified by the calling variable's Decimals property.
Instances where the value to be aligned is non-zero are not affected.
decimalChar
This should be a quotation mark delimited comma or period ("," or "."), to specify the decimal character to use for calling variables with the Decimals property set to true. This overrides the inherited or local Decimal Char property (if set), of the calling variable.
Example
In this example, use of the following LeftAlign method invocations, with differing parameter lists result in different AlphOut variable values, as listed in the following table.
AlphOut.LeftAlign(NumIn) Alphout.LeftAlign(NumIn, true) Alphout.LeftAlign(NumIn,false,",") Alphout.LeftAlign(NumIn, true, ",")
Each blank in the AlphOut value is denoted by an asterisk ('*').
NumIn | NumIn Decimals | AlphOut | |||
---|---|---|---|---|---|
NumIn | NumIn, true | NumIn, false,"," | NumIn, true, "," | ||
724 | None | 724****** | 724****** | 724****** | 724****** |
-724 | None | -724***** | -724***** | -724***** | -724***** |
123.45 | 2 | 123.45*** | 123.45*** | 123,45*** | 123,45*** |
123.45 | 4 | 123.4500* | 123.4500* | 123,4500* | 123,4500* |
-123.45 | 3 | -123.450* | -123.450* | -123,450* | -123,450* |
-123.45 | 6 | -123.4500 | -123.4500 | -123,4500 | -123,4500 |
-12345.6789 | 4 | -12345.67 | -12345.67 | -12345,67 | -12345,67 |
0.12 | 2 | .12***** | .12***** | ,12***** | ,12***** |
-0.12 | 3 | -.120*** | -.120*** | -,120*** | -,120*** |
0 | None | ********* | 0******** | ********* | 0******** |
0 | 1 | ********* | .0******* | ********* | ,0******* |
0 | 2 | ********* | .00****** | ********* | ,00****** |
0 | 4 | ********* | .0000**** | ********* | ,0000**** |
0 | 8 or more | ********* | .00000000 | ********* | ,00000000 |