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                                              
laur...@nemesys-soft.com

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" <laur...@nemesys-soft.com> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to