I wrote a function that gives me the length of a dynamic array by converting it to string and asking length(trim(string));
function arraylength(a: array of char): integer;
var i: integer;
s: string;
begin
for i:=0 to high(a) do
begin
s[i] := a[i-1];
Result := length(trim(s));
end;
end;
In my main program i read text into a string, convert it to array
procedure TForm1.Button2Click(Sender: TObject);
var i: integer;
begin
for i:=0 to length(sString) do
begin
cChar[i] := sString[i];
end;
end;
and do:
ShowMessage(IntToStr(arraylength(cChar)));
I get the error as stated in the title.