Re: strange behaviour of hasPrefix
Re: strange behaviour of hasPrefix
- Subject: Re: strange behaviour of hasPrefix
- From: Ben Kennedy <email@hidden>
- Date: Wed, 3 May 2017 10:05:34 -0700
> On 03 May 2017, at 8:25 am, Gerriet M. Denkmann <email@hidden> wrote:
>
> NSString *test2 = [ @"/some/path" stringByAppendingPathComponent: pintu ].lastPathComponent;
> [ self printTestString: test2 ];
> // prints: length 2 0x2d 0xe3a “-ฺ” BAD: has no prefix "-" NSPathStore2 ← NSString
> Why has test2 no prefix?
If I'm reading your code right, I would imagine this is because test2 obviously begins with a slash ("/some/path/...") and not "-".
-[NSString hasPrefix:] :
> Returns a Boolean value that indicates whether a given string matches the beginning characters of the receiver.
-ben
_______________________________________________
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