When I have NSString
with /Users/user/Projects/thefile.ext
I want to extract thefile
with Objective-C methods.
What is the easiest way to do that?
cocoaobjective c
When I have NSString
with /Users/user/Projects/thefile.ext
I want to extract thefile
with Objective-C methods.
What is the easiest way to do that?
Best Answer
Taken from the NSString reference, you can use :
The
lastPathComponent
call will returnthefile.ext
, and thestringByDeletingPathExtension
will remove the extension suffix from the end.