Page 1 of 1

Extract path

Posted: Fri Jan 13, 2017 8:00 am
by KrilleJ
Is there any convenient (pre-built) way to extract the path part of a string that is returned from uifiledlg?

That is, from

@uifiledlg(%myFile, "prg", "open")

could I extract the path part of %myFile and separate it from the file part?

Best,
Kristian

Edit:

The current clunky solution that I have is:

Code: Select all

%pureFileName="" for !currPos=1 to @length(%myFile) if @mid(%myFile, !currPos, 1)="\" then %pureFileName="" else %pureFileName=%pureFileName + @mid(%myFile, !currPos, 1) endif next string file=%pureFileName string Path=@replace(%myFile, %pureFileName, "")
Any smoother way is very welcome.

Re: Extract path

Posted: Fri Jan 13, 2017 8:40 am
by EViews Gareth
No, but you can improve the klunkiness by using the @instr function