SameSung Vs Iphone
SameSung Vs Iphone

Reputation: 614

Finding extension of an URL

i have a string named url i.e

NSString *url = @"http://sound17.mp3pk.com/indian/barfi/%5BSongs.PK%5D%20
                  Barfi%20-%2001%20-%20Barfi!.mp3";

Now I want that It should search from last upto the .(dot)

i.e it should search mp3 in string as it is coming after .(dot) and want to store that mp3 in the temporary variable. how can i use lastindex(".") or something else to store in temporary variable.

Upvotes: 4

Views: 1814

Answers (1)

DrummerB
DrummerB

Reputation: 40211

Simple as that:

NSString *extension = [url pathExtension];

Upvotes: 11

Related Questions