Question Finding last position in character array.

Hello everybody,

Firstly, I looked for an answer here in the forums, and didn't find any, so in case this thread has alredy been answered before, my apologies.

I'll try to make it as simply as it gets, and even tough it looks simply, I've been having a hard time trying to make a good solution out of it.
Now, the problem itself...

I have an array, wich has been defined as a CHARACTER type variable, and wich I find the elements I need by using the ENTRY function, as it follows (Thats just an exemple code):

DEFINE VARIABLE cArray AS CHARACTER INITIAL "a b c d e f g" NO-UNDO.
DISPLAY ENTRY(1, cArray, " ").​

And now I'm facing some problems because I need to find the LAST entry of that array, and i DON'T KNOW it''s size, nor the size of each element.

My question so is if there is an easy/simply way wich I could get how many elements are there in this array, splitted by " " (spaces), or any other separators that I may choose.


Thanks in advance,

Guilherme A.
 
Last edited:

TomBascom

Curmudgeon
BTW -- that's not an array. It is a space delimited list contained in a string variable. An array would be something like:

Code:
define variable myArray as character no-undo extent 7 initial
  [ "a", "b", "c", "d", "e", "f", "g" ]
.
 
Top