How can I access single characters of a STRING variable declared as ARRAY?

If you want to access single characters of a STRING variable and this variable has been declared as an array, this is possible by the following assignments:

Example
PROGRAM Test
VAR
vChar1, vChar2 : CHAR;
aString : ARRAY[1..5] of STRING[10];
AccessHelp : STRING[10];
END_VAR
vChar1 := aString[4][3]; (* accessing the 4th ARRAY element *)
 
(* alternate access *)
AccessHelp := aString[4]; (* 1st assignment: accessing the 4th ARRAY element *)
vChar2 := AccessHelp[3]; (* 2nd assignment: accessing the 3rd character of the 4th ARRAY element *)
END_PROGRAM

Information on STRING variables are listed under "Declaration of STRING variables (incl. access)".

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg logi.cals recommends to install and use the most current versions of logi.CAD 3 and the runtime system so that the latest features and problem fixes according to the release notes are provided in the used version.


Did this article help you? Did you find the requested information in this user documentation?
If not, contact the support team of logi.cals. State your questions or suggestions to improve/enhance the user documentation as detailed as possible.