Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 647
SameSung Vs Iphone Avatar asked Dec 20 '22 16:12

SameSung Vs Iphone


1 Answers

Simple as that:

NSString *extension = [url pathExtension];
like image 57
DrummerB Avatar answered Jan 09 '23 20:01

DrummerB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!