Arrays and Strings
36
Axcess Programming Language
DEFINE_PROGRAM
TEMP[1] = SCREEN_UP
TEMP[2] = 5
TEMP[3] = Ø
TEMP[4] = 'N'
TEMP[5] = 'O'
TEMP[6] = X
CAM_PRESETS = TEMP
The contents of the array CAM_PRESETS, after this code is executed, depend on the length value
of the TEMP variable. If this were the entire program, TEMP would have a default length of Ø, so
nothing would be copied into CAM_PRESETS. To assure that CAM_PRESETS holds a copy of
TEMP, you would first need to set the length value of the TEMP array with this line inserted before
the copy statement:
SET_LENGTH_STRING(TEMP,6)
The line above, when executed with the previous code example, renders the following result:
TEMP = "SCREEN_UP,5,Ø,'NO',X"
After this, the length value of TEMP is 6; so, the first 6 locations of TEMP will be used in all cases
where you refer to the entire array.
Array Manipulation Keywords
The following keywords allow you to manipulate arrays and retrieve certain portions of an array:
Array Manipulation Keywords
LEFT_STRING
LEFT_STRING returns a string containing the number of characters specified
starting at the beginning of the string.
For this keyword, you must specify two parameters: the string or array you are
referencing and the number of characters you need.
Example:
STR = LEFT_STRING (PRESETS,3)
After execution of this line, the array STR will contain the first 3 characters of
the array PRESETS. If PRESETS contains the string 'HELLO', then STR will
contain 'HEL.' Also, the length value of STR will be set to 3.
RIGHT_STRING
This keyword requires the same parameters as LEFT_STRING. However,
RIGHT_STRING begins reading at the end of the string array for the specified
amount of characters.
Example:
STR = RIGHT_STRING (PRESETS,2)
Assuming PRESETS still contains 'HELLO', replacing LEFT_STRING in the
previous example with RIGHT_STRING will assign the string 'LLO' to STR.
This keyword also will set the length value of the array receiving the result.
MID_STRING
This keyword returns the specified amount of characters starting at a specified
location in the source string. Three parameters, rather than two, are needed for
its operation: the string to reference, the position at which to start, and the
number of characters to return.
Example:
STR = MID_STRING (PRESETS,2,3)
This line tells Axcess: "Place three characters from the array PRESETS, start-
ing at location 2 and moving to the right, into the array variable STR." If PRE-
SETS contains 'HELLO', this line will assign 'ELL' to the array STR. This
keyword also will set the length value of the array receiving the result.
Содержание Axcess
Страница 1: ...instruction manual Software Axcess Programming Language ...
Страница 8: ...vi Axcess Programming Language Table of Contents ...
Страница 12: ...Introduction 4 Axcess Programming Language ...
Страница 22: ...Axcess Basics 14 Axcess Programming Language ...
Страница 38: ...Channel Characteristics 30 Axcess Programming Language ...
Страница 54: ...Levels 46 Axcess Programming Language ...
Страница 62: ...Operators 54 Axcess Programming Language ...
Страница 66: ...Variable Types and Conversions 58 Axcess Programming Language ...
Страница 70: ...Two Dimensional Arrays 62 Axcess Programming Language ...
Страница 80: ...While Keywords 72 Axcess Programming Language ...
Страница 86: ...Using Buffers 78 Axcess Programming Language ...
Страница 94: ...Waits and Timer Keywords 86 Axcess Programming Language ...
Страница 102: ...Using Subroutines 94 Axcess Programming Language ...
Страница 108: ...Include Files and System_Calls 100 Axcess Programming Language ...
Страница 120: ...Compiler Error Messages 112 Axcess Programming Language ...
Страница 124: ...The External_Control Protocol 116 Axcess Programming Language ...
Страница 143: ...Index 135 Axcess Programming Language ...