Gathering the last part of a text string

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Gathering the last part of a text string

Post by quailcreek » Mon Apr 13, 2015 1:17 am

Hello everybody,
I need to gather the name of an image file from the images fileName in the stack. The short name of the file in the stack is not necessarily the same. So I can't use "get the short name of..." How do I extract the “the file name.gif” part of this path string?

/thisFolder/thatFolder/images/the file name.gif

Thanks for the help!
Tom
MacBook Pro OS Mojave 10.14

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Gathering the last part of a text string

Post by sefrojones » Mon Apr 13, 2015 1:56 am

This might work:

Code: Select all

   put "/thisFolder/thatFolder/images/the file name.gif" into tPath
   set the itemdelimiter to slash
   put the last item of tPath
--Sefro

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: Gathering the last part of a text string

Post by quailcreek » Mon Apr 13, 2015 5:04 am

Thanks, Sefro. That was perfect. itemdel was what I was missing.
Tom
MacBook Pro OS Mojave 10.14

Post Reply