|
This is way simpler I think - not tested though.
filename = %subst( %trimr(input) : ( %scanR( '/': %trimr(input) + 1 );
%trimR not needed if the input is varchar.
Simplified it would look like this:
tempVarchar = %trimR( input );
filename = %subst( tempVarchar : ( %scanR( '/': tempVarchar ) + 1 );
I _think_ that example may have originated with Barbara Morris when %ScanR came out.
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
On Aug 1, 2018, at 9:55 AM, JRusling@xxxxxxxxxxx wrote:
Heh heh heh. . . (sheepish) . . . yes Rob.
John
Methinks that LastPos is something you wrote, but failed to include?
//===============================================================
p LastPos...
p b
d pi 10i 0
d pString 256 const varying
d pWhat 1 const
// Pass in a string and this returns the rightmost position
// of the 'What' (2nd) parameter. Could be . or a / or anytin.
//===============================================================
d len s 10i 0
d spos s 10i 0
d pos s 10i 0
d lastpos s 10i 0
len = %len(%trimr(pString));
spos = 1;
//---
dou (pos=0) or (spos>=len);
pos = %scan(pWhat :pString :spos);
if pos> 0;
spos = pos + 1;
lastpos = pos;
endif;
enddo;
//---
return lastpos;
p e
<br />
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in reliance on it, is
prohibited and may be unlawful.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.