copy subset of character array to another character array
Posted on 2011-10-17
I am trying to copy part of one character array to a shorter character array. I found this solution so am trying to do it this way:
ShorterArray := Copy(LongArray, 0, Number);
I sized the shorter array to Number. Long array is the longer source array. 0 is the first element of the source array to copy. Number is the number of elements to copy. During complie I get the error saying "incompatible types 'Dynamic Array' and 'String'".
Why isn't this working ? Does it not work with a character array ? Or can't I do it with a dynamic array ? I assume I could loop through the elements copying them one at a time, but wanted the most elegant solution. Is there a better way ? Can I size the destination array at the same time ?