• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Quick way to find is a path is contained in another path?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quick way to find is a path is contained in another path?


  • Subject: Re: Quick way to find is a path is contained in another path?
  • From: Laurent Daudelin <email@hidden>
  • Date: Fri, 18 Mar 2011 17:04:19 -0700

Yeah, I found out that hasPrefix: was not really a good one...

-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 				http://www.nemesys-soft.com/
Logiciels Nemesys Software              				email@hidden

On Mar 18, 2011, at 17:58, Gary L. Wade wrote:

> If you're not concerned about mount-path inclusion, where Library may be
> on another volume but mounted at that point, use
> rangeOfString:options:range: with an anchored search option and range
> consisting of the full length of the laurent-ending string.  You have
> three possible results: not found (no), lengths are equal (yes), or length
> to search is larger than the length found (maybe).  In that last case, see
> if the next character after the found range is a path separator.  If it
> is, (yes); if not, (no).  The method hasPrefix: is pretty much a
> convenience for this call but does not differentiate in the last case and
> would always return yes.
>
> On 03/18/2011 2:59 PM, "Laurent Daudelin" <email@hidden> wrote:
>
>> I have a couple of ideas using "pathComponents" but does anybody have a
>> quick way to find if a given path is contained in another path, e.g. if
>> "/Library/Users/laurent/Library" is contained in "/Library/Users/laurent"
>> (in this case, it is)?

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Quick way to find is a path is contained in another path? (From: "Gary L. Wade" <email@hidden>)

  • Prev by Date: Re: Quick way to find is a path is contained in another path?
  • Next by Date: Re: Releasing memory allocated by CoreData's _PFAllocateObjects function?
  • Previous by thread: Re: Quick way to find is a path is contained in another path?
  • Next by thread: Splitting a single Core Data model between several files
  • Index(es):
    • Date
    • Thread