xcode – iPhone – Objective c

if you have file path and want to get file extension you can use [NSString : pathExtension] “Interprets the receiver as a path and returns the receiver’s extension, if any.” , “myFile.txt” will return “txt”

 

and if you want to delete file extension and get only file name “myFile.txt” will be “myFile” , you can use [NSString : stringByDeletingPathExtension] “Returns a new string made by deleting the extension (if any, and only the last) from the receiver.”