How can I extract a URL from a sentence that is in a NSString?
Posted
by
0SX
on Stack Overflow
See other posts from Stack Overflow
or by 0SX
Published on 2011-01-04T03:40:59Z
Indexed on
2011/01/04
4:53 UTC
Read the original article
Hit count: 489
What I'm trying to accomplish is as follows. I have a NSString with a sentence that has a URL within the sentience. I'm needing to be able to grab the URL that is presented within any sentence that is within a NSString so for example:
Let's say I had this NSString
NSString *someString = @"This is a sample of a http://abc.com/efg.php?EFAei687e3EsA sentence with a URL within it.";
I need to be able to extract http://abc.com/efg.php?EFAei687e3EsA from within that NSString. This NSString isn't static and will be changing structure and the url will not necessarily be in the same spot of the sentence. I've tried to look into the three20 code but it makes no sense to me. How else can this be done? Thanks for help.
© Stack Overflow or respective owner