× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Wed, Aug 1, 2018 at 9:40 AM, Jack Woehr
<jwoehr@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
there's a one-liner in QSH

$
basename
basename: 001-3001 usage: basename string [suffix]
$

This is indeed handy, though there's a bit of rigamarole to get the
result back to RPG.

One very small caveat for a corner case (which I'm only aware of
because documentation for Python's basename function specifically
points this out) is that basename ignores all trailing slashes, except
for the first character in the string. In other words, if you have a
string consisting solely of slashes, basename will return a single
slash.

Stripping trailing slashes may or may not make sense depending on
context, but it is different than most home-grown solutions (and
Python's basename).

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.