I have a NSURL
NSURL* url = [NSURL URLWithString:@"http://www.google.com"];
I want to get the "google" from this string , How can i do that?
You can get just the domain part with this:
[url host]
...will get you www.google.com, then you'll need to do some regex/string replacement to strip off the www. and .com parts.
I'd suggest a regex something like the following:
\.?(.+)\.([a-z]{2,})$
...then pull out that first match for the part you want.