comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » extracting all but...
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
extracting all but... [message #46307] Fri, 18 November 2005 18:15 Go to next message
Koh Leong Tah is currently offline  Koh Leong Tah
Messages: 11
Registered: May 2005
Junior Member
Hi All,

I was wondering how I can extract all but a constant string from an
array of strings?
basically, I have an array of filenames with a particular directory
prefixed to each of the filenames like so:

files =
['/some/constant/directory/file1','/some/constant/directory/ file2',
etc.]

and would like to have just an array of the filenames without the
prefixed directory name so that the result looks like:

files = ['file1', 'file2', etc.]


any ideas?

Cheers,
KL
Re: extracting all but... [message #46443 is a reply to message #46307] Sun, 20 November 2005 08:25 Go to previous message
Robert Moss is currently offline  Robert Moss
Messages: 74
Registered: February 1996
Member
kl_tah@hotmail.com wrote:
> Hi All,
>
> I was wondering how I can extract all but a constant string from an
> array of strings?
> basically, I have an array of filenames with a particular directory
> prefixed to each of the filenames like so:
>
> files =
> ['/some/constant/directory/file1','/some/constant/directory/ file2',
> etc.]
>
> and would like to have just an array of the filenames without the
> prefixed directory name so that the result looks like:
>
> files = ['file1', 'file2', etc.]
>
>
> any ideas?
>
> Cheers,
> KL
>

You want to use the FILE_BASENAME function. It will extract the file
name in just the way you require. You might also look at the
FILE_DIRNAME function. It can also be handy for the types of
manipulations you are doing here.

--
Robert Moss, PhD
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: extracting strings between ' '
Next Topic: Changing tag definition/type

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:26:24 PDT 2025

Total time taken to generate the page: 0.00494 seconds