[fpc-pascal] Get highest element of a StringList

James Richters james.richters at productionautomation.net
Sat Sep 10 19:57:51 CEST 2022


This Helper sounds like a nice way to do it.  I need the numerical index of
the loop so this would be more straight forward.
Would I then do something like :
For I:= 0 to MyStringList.High Do 
?

When I try to add the Type statement:
type TStringListHelper = class helper for TStringList function High:
NativeInt; end;
I get    Error: Identifier not found "class"

I have the Classes unit.  Is there something else I am missing?

James

>Another alternative would be declaring a helper:

>type TStringListHelper = class helper for TStringList function High:
NativeInt; end;

>function TStringListHelper.High: NativeInt; begin
>  Exit (Self.Count-1);
>end;



More information about the fpc-pascal mailing list