Hi Folks,
I am very new to LiveCode, but trying to get up to speed quickly. Right now I am stuck trying to parse a file path, so given the following file path:
/some/foo/bar/path/to/bingo.html
how can I put the filename bingo.html into a container? I have searched and searched without success. It seems to be more complicated than it needs to be.
Any help or pointers to documentation would be greatly appreciated.
Thanks,
Daryl
get path basename or how to parse a file path
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: get path basename or how to parse a file path
Hi..
will put 'bingo.html' into the msg box
Dixie
Code: Select all
set itemDel to slash
put "/some/foo/bar/path/to/bingo.html" into theString
put the last item of theString
Dixie
Re: get path basename or how to parse a file path
Another useful trick to know is that
will give you the enclosing folder of bingo.html, i.e., "/some/foo/bar/path/to".
Code: Select all
put item 1 to -2 of theString
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: get path basename or how to parse a file path
Wow! That was fast and very useful. Thank you both, Dixie and mwieder for your suggestions, I appreciate both of your responses, and they will prove very useful to me.
Best Regards,
Daryl
Best Regards,
Daryl