How do I remove part of a path?

Pete pete at mollysrevenge.com
Mon Aug 1 02:03:23 EDT 2011


Yes, it should be:

replace "/" & item 4 of <wherever your url is> with empty in <wherever your
url is>

The other way works if he's always looking to replace the same string, this
is better if the string is always in a known position but the string itself
could vary.

I have so many instances where I need to set the itemdelimiter to tab that I
wrote a handler to deal with it.

function tabItem pitem,pstring
   set the itemdelim to tab
   return item pitem of pstring
end tabItem

put tabItem(4,mystring) into myItem

Since itemdelim is local to the handler, no need to store it away and
restore it.  Nothing fancy but probably saved me a few hundred lines of
code, and forgetting to restore the itemdelim in the calling handlers.

I wish there was a way to "put column 4 of <string> into xyz" using the
columndelimiter setting (default tab) but I think columndelimiter only
applies to the split and combine commands for handling arrays.

Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Sun, Jul 31, 2011 at 7:51 PM, Michael Kann <mikekann at yahoo.com> wrote:

> Pete,
>
> One little improvement is needed:
>
> replace item 4 of <wherever your url is> with empty in <wherever your url
> is>
>
> When I change the itemDelimiter to something exotic I almost always forget
> to change it back then wonder why those items don't obey. If you are going
> to change the itemDelimiter you might try something like:
>
> put the itemDel into old_delimiter
> set the itemDel to "/"
> -- gather some items
> set the itemDel to old_delimiter
>
> Mike
>
>
> --- On Sun, 7/31/11, Pete <pete at mollysrevenge.com> wrote:
>
> From: Pete <pete at mollysrevenge.com>
> Subject: Re: How do I remove part of a path?
> To: "How to use LiveCode" <use-livecode at lists.runrev.com>
> Date: Sunday, July 31, 2011, 9:36 PM
>
> replace "/public.html" with empty in <wherever the url is>.  That's
> assuming
> it's always the same string you want to get rid of.  Alternatively:
>
> set the itemdelimiter to "/"
> replace item 4 of <wherever your url is> with empty
>
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
>
>
>
>
> On Sun, Jul 31, 2011 at 6:58 PM, Admin <admin at mfelkerco.com> wrote:
>
> >
> >
> > Hello all,
> >
> > Say I have the following path:
> >
> >
> >
> >
> http://www.travelandworkusa.com/public_html/userfiles/Felker_Mike/robot_trans_noshadow.png
> >
> >
> > How do I get rid of just /public_html ?
> >
> > Thanks.
> >
> > Mike
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> >
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>



More information about the use-livecode mailing list