Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out the extension part of URL saved in NSString

How to find out and save the extension of fields that i am going to save in photo album. i want know it which format. example:

http://www.example.com/myvideo.mp4, http://www.example.com/mypicture.png

I need is like .mp4 and .png.If possible give me example code.

like image 205
Subin Kurian Avatar asked Aug 04 '12 15:08

Subin Kurian


Video Answer


1 Answers

NSURL also have pathExtension (Available in iOS 4.0 and later.)

NSString *extension = [[NSURL URLWithString: @"http://sample.example.com/path/hellowwrod.ext"] pathExtension];
like image 106
yogs Avatar answered Nov 15 '22 21:11

yogs