Parsing A File Path
Sarah Reichelt
sarah.reichelt at gmail.com
Wed Feb 21 16:56:03 EST 2007
On 2/22/07, Ian Wood <revlist at azurevision.co.uk> wrote:
> Try something like:
>
> set the itemdelimiter to "/"
> put last item of tFullPath into tFilename
> put tFullPath into tPath
> replace tFilename with "" in tPath -- path without the name
> set the itemdelimiter to "."
> put item 1 of tFilename into tName -- file name without extension
> put last item of tFilename into tExt -- file extension
>
> Note that this will fail badly if people are putting multiple periods
> into the file name, but it should be a start.
>
It won't fail if you do this:
set the itemdelimiter to "."
put item 1 to -2 of tFilename into tName -- file name without extension
put last item of tFilename into tExt -- file extension
Cheers,
Sarah
More information about the use-livecode
mailing list