parsed pathname - answer found

Barry Levine themacguy at macosx.com
Tue Jan 27 15:33:10 EST 2004


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.

Ciao!

Barry



More information about the use-livecode mailing list