I have an array of String but I do not know how many elements in it. If the user put 3 elements in the array then the total of index = 3. How can I scan all the elements array if it is not equal to '' (meaning NULL) and get the total of index in the array?
Thank you in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
FOR i:=(First element of array eg.0) TO (Last element of array eg.10) DO
IF String[i] = '' THEN
Count := Count;
ELSE
Count := Count + 1;
END_IF;
END_FOR;
This will add 1 to the 'Count' in each instance that the String has any value other than NULL in it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have an array of String but I do not know how many elements in it. If the user put 3 elements in the array then the total of index = 3. How can I scan all the elements array if it is not equal to '' (meaning NULL) and get the total of index in the array?
Thank you in advance
Count := 0;
FOR i:=(First element of array eg.0) TO (Last element of array eg.10) DO
IF String[i] = '' THEN
Count := Count;
ELSE
Count := Count + 1;
END_IF;
END_FOR;
This will add 1 to the 'Count' in each instance that the String has any value other than NULL in it.