How do I remove part of a path?
Pete
pete at mollysrevenge.com
Mon Aug 1 13:11:41 EDT 2011
Another variant might be:
replace "/" & item 4 of myURL with empty in myURL
As an aside, I have found a very frequent need to parse out tab-delimited
strings and had been doing it by setting the itemdelimiter to tab and back
again. I got myself in trouble so many times by forgetting to set the
itemdelimiter back to its original value that I wrote a short handler to do
this:
function tabItem pitem,pstring
set the itemdelimiter to tab
return item pitem of pstring
end tabItem
put tabItem(3,myString) into myColumn
Since the itemdelimiter setting is local to a handler, don't need to
save/reset it. Saved me a few hundred lines of coding and eliminated
itemdelimiter debuggung issues.
I wish there was a tab-delimited chunk type native to LC. I see there is a
columndelimiter property that is set to tab but I think it's only use is for
combine and split on arrays. Would be great to be able to do "put column 3
of myString into myColumn".
Pete
Molly's Revenge <http://www.mollysrevenge.com>
On Mon, Aug 1, 2011 at 8:38 AM, Michael Kann <mikekann at yahoo.com> wrote:
> Jim,
> Now I get it. Good one-liner.
> Mike
>
> --- On Mon, 8/1/11, Jim Ault <jimaultwins at yahoo.com> wrote:
>
> From: Jim Ault <jimaultwins at yahoo.com>
> Subject: Re: How do I remove part of a path?
> To: "How to use LiveCode" <use-livecode at lists.runrev.com>
> Date: Monday, August 1, 2011, 10:28 AM
>
> "itemToParse" is a variable name I created that contains the string, such
> as
>
> "http://domain.com/subfolder/subfolder/page.html"
>
> Sorry about the confusion.
> Perhaps I should have used "tStringOfItemsToParse"
>
>
More information about the use-livecode
mailing list