Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Last component of a folder path
#2
The beauty of a macro program is that you can get the job done with more than one way.
Your method is pretty good though, but there are several other methods to get the same result.
Here are some of them that I can think of:
Macro temp1
Code:
Copy      Help
str s1 s="S:\lev1\lev2\lev3\lev.last"
ARRAY(str) a
int ntok=tok(s a -1 "\")
s1=a[ntok-1]
out s1
Macro temp2
Code:
Copy      Help
str s="S:\lev1\lev2\lev3\lev.last"
str s1=s
_s.getpath(s)
out s1.replace("" 0 _s.len)
Macro temp3
Code:
Copy      Help
str s1 s="S:\lev1\lev2\lev3\lev.last"
_s.getpath(s)
out s1.get(s _s.len)
;or
;out s1.right(s s.len-_s.len)
Last but not least:
Macro temp4
Code:
Copy      Help
str s="S:\lev1\lev2\lev3\lev.last"
out _s.getfilename(s 1)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)