Welcome to %s forums

BrainModular Users Forum

Login Register

use of string.endswith

I need help on a Patch
Post Reply
woodslanding
Member
Posts: 1327
Contact:

use of string.endswith

Unread post by woodslanding » 08 Oct 2022, 08:12

This method is not working for me. Maybe I misunderstand the syntax?

Here is my method:

Code: Select all

procedure findFileAndLoad;
var filenames : TStringList;
var nsfile,targetName : string; 
var i:integer;
begin
    if targetNameIN.length > 0 then
    begin
        //get commatext for file list input
        filenames.setCommatext(filelistIN.asString);
        targetName = targetNameIN.asString;
        //search for a filename that ends with the target string
        //function string.endswith   ( AValue:string ) : boolean;
        for i := 0 to filenames.count do
        begin
            nsfile = filenames.getStrings(i);
            //call load text with the found filename
            if nsfile.endswith(targetName) then loadText(nsfile);
        end;
                 
    end;
end;  
gives me 'unknown declaration 'endswith'

Thoughts?

Thanks!
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 08 Oct 2022, 09:41

hi, dont forget that the assignation is Pascal is:

Code: Select all

:=
not

Code: Select all

=

Code: Select all

 targetName := targetNameIN.asString;
 nsfile := filenames.getStrings(i);

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 15 Oct 2022, 07:12

This is the problem when I go back to Pascal, after programming in anything else for a while... :/

THANKS!
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

Post Reply

Who is online

Users browsing this forum: No registered users and 101 guests