Using @replace with wildcard

For questions regarding programming in the EViews programming language.

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

lisacabisa
Posts: 1
Joined: Fri Jun 03, 2011 9:49 am

Using @replace with wildcard

Postby lisacabisa » Fri Jun 03, 2011 9:56 am

Is it possible to use @replace string function with a wildcard? If not, does anyone have an idea how to do what I'm trying to do?

I am trying to strip off the path information so I have just the Eviews workfile name.

%wfpath = "C:\work\Eviews\q2fy10_sys.wf1"
%wf = @replace(%wfpath,"*\","")

I would expect replacement to remove all characters up to and including the last backslash so that %wf is equal to q2fy10_sys.wf1

Does not seem to work...

TIA

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

Re: Using @replace with wildcard

Postby EViews Gareth » Fri Jun 03, 2011 10:10 am

No, it doesn't work that way (nor could it, logically).

If you know that your path has 3 slashes in it, then you can use @instr and @mid to do what you want:

Code: Select all

%wfpath = "C:\work\Eviews\q2fy10_sys.wf1" %wf = @mid(%wfpath, @instr(%wfpath, "\", 3)+1)

monjoride
Posts: 1
Joined: Sat Jul 02, 2011 2:11 am

Re: Using @replace with wildcard

Postby monjoride » Sat Jul 02, 2011 2:12 am

and if the path is longer than 3 slashes?

Action Plan Of GSM Repeater
GSM Repeater 900Mhz
Last edited by monjoride on Mon Jul 14, 2014 7:00 am, edited 3 times in total.

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

Re: Using @replace with wildcard

Postby EViews Gareth » Sat Jul 02, 2011 11:40 am

Code: Select all

%wfpath = "C:\work\Eviews\q2fy10_sys.wf1" %wf = %wfpath !pos = @instr(%wf, "\") while !pos>0 %wf = @mid(%wf, !pos+1) !pos = @instr(%wf, "\") wend
Or something along those lines.

Gardner
Posts: 1
Joined: Fri Apr 27, 2012 4:58 am
Contact:

Re: Using @replace with wildcard

Postby Gardner » Fri Apr 27, 2012 5:20 am

Hey...
Nice link shared...
Its a great site for getting the information...
Thank you for sharing this great informative stuff here...
_______________
basement dehumidifier
Last edited by Gardner on Sat Apr 28, 2012 5:00 am, edited 1 time in total.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests