Extract path

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

KrilleJ
Posts: 40
Joined: Fri Feb 20, 2015 6:15 am

Extract path

Postby KrilleJ » Fri Jan 13, 2017 8:00 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13585
Joined: Tue Sep 16, 2008 5:38 pm

Re: Extract path

Postby EViews Gareth » Fri Jan 13, 2017 8:40 am

No, but you can improve the klunkiness by using the @instr function


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests