Re: NSURL from non-url NSString
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