• 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: NSURL from non-url NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURL from non-url NSString


  • Subject: Re: NSURL from non-url NSString
  • From: Jens Alfke <email@hidden>
  • Date: Sun, 25 May 2014 09:51:40 -0700

On May 25, 2014, at 8:05 AM, Koen van der Drift <email@hidden> wrote:

> However, I noticed that strings that have the form P12345 also turn blue.  Any idea why that string would turn into an NSURL?  The url scheme is nil, and the path components just show P12345.

It’s a relative URL — just a single path component, that could be appended to an absolute URL.

Trying to recognize plausible URLs is harder than it seems at first glance. I have some boilerplate code that checks whether the scheme is non-nil and longer than one character. If you really want to do it correctly, I think Data Detectors has API for it.

—Jens
_______________________________________________

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: 
 >NSURL from non-url NSString (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: Understanding ARC
  • Next by Date: Re: string literals and performance
  • Previous by thread: Re: NSURL from non-url NSString
  • Next by thread: NSPopover + Bindings + Validation = Weirdness
  • Index(es):
    • Date
    • Thread