• 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: strange behaviour of hasPrefix
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >strange behaviour of hasPrefix (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: NSSplitView Problems
  • Next by Date: Re: NSSplitView Problems
  • Previous by thread: strange behaviour of hasPrefix
  • Next by thread: Re: strange behaviour of hasPrefix
  • Index(es):
    • Date
    • Thread