Variable Types and Conversions
There are certain limitations of integer arrays. If an integer array is assigned to a normal array.
Values above 255 are truncated. For more information on truncating values, refer to Definition
Sections on page 9. This also happens if an integer array is sent to a device using the keywords
SEND_STRING or SEND_COMMAND. There is no problem, however, in assigning a normal
array to an integer array.
!
!
Conversion keywords
The following keywords automatically set the length value of the resulting string.
Conversion Keywords
ATOI
INTEGER
ITOA
56
An integer array takes up twice as much Axcess memory than would a normal array of
the same storage capacity.
If your array is only going to hold alphanumeric values, it is not necessary to make it an
integer array.
ATOI stands for "ASCII to integer". It takes a string literal, string expression, or
array as a parameter, and returns a single integer as the result.
Example:
DEFINE_CONSTANT
STR1 = '456'
STR2 = 'YES789GO19'
DEFINE_PROGRAM
NUM = ATOI('123')
NUM = ATOI(STR1)
NUM = ATOI(STR2)
If the string contains all non-numeric characters (such as HELLO), ATOI
returns the integer Ø. However, if there are any numeric characters embedded
in the string, ATOI returns the first complete set it comes upon, as is the case
with STR2 above. Notice that only the first set of numbers from STR2 is
returned.
This keyword is placed in front of the array name to denote the array as an inte-
ger array. For more information, see Integer Arrays on page 55.
It can only be used in the DEFINE_VARIABLE and LOCAL_VAR sections
when declaring arrays.
ITOA stands for "integer to ASCII". It creates a string that represents the deci-
mal value of a number.
Example:
DEFINE_CONSTANT
CONST = 456
DEFINE_VARIABLE
STR[5]
VAR
DEFINE_PROGRAM
VAR = 789
STR = ITOA(123)
STR = ITOA(CONST)
STR = ITOA(VAR)
The comment after each statement shows the value of the array STR after
each assignment. The length value of STR is set to 3 in each case.
(* NUM = 123 *)
(* NUM = 456 *)
(* NUM = 789 *)
(* STR = '123' *)
(* STR = '456' *)
(* STR = '789' *)
Axcess Programming Language
Need help?
Do you have a question about the AXCESS CONTROL SYSTEM PROGRAM and is the answer not in the manual?