I want to write a method:
Function TChunk.Chunk(Constref input: String; location: TLocation): String;
Begin
Result := input.Substring(location.FStart, location.GetLen);
End;
but I get Error: Illegal qualified. The goal is to return a sub-string from input by a range (the location defines the range) – super simple kid’s task. I cannot:
- find the required string method
- to understand how to call string’s helper method –
Substring() - to understand how to do this simple task in FreePascal
My strings are unicode strings actually (i am not sure in the right terminology here, but they are not ASCII (Delphi Unicode (-MDelphiUnicode)).
Any help for a Pascal newbie, please 🙂
EDIT: the origin of this method

>Solution :
Try with copy.
instead of:
Result := input.Substring(location.FStart, location.GetLen);
use:
Result := copy(input,location.FStart,location.GetLen);
