parsed pathname - answer found

Scott Rossi scott at tactilemedia.com
Tue Jan 27 15:46:53 EST 2004


Recently, "Barry Levine"  wrote:

> As is usually the case, posting a question to the list prompts me to
> re-double my efforts. My question was how to find the last part of a
> pathname (after the last "/") given the entire path. Here's what I came
> up with:
> 
> on mouseUp
>  put field "folderList" into vMyPath -- (the path was stored in that
> field)
>  repeat with i = the number of chars in vMyPath down to 1
>    if char i of vMyPath = "/" then exit repeat
>    put char i of vMyPath before vParsedPath
>  end repeat
>  answer vParsedPath -- (or do anything else now that we have it)
> end mouseUp
> 
> Seems to work pretty well though I'm sure there's a more elegant method.

You could try this:

 on mouseUp
   set itemDel to "/"
   answer last item of fld "folderList"
 end mouseUp

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the use-livecode mailing list