When I have a path, I can use os.path.split() in Python to get directory name, and file name.
>>> x = '/a/b/c/hello.txt'
>>> import os.path
>>> os.path.split(x)
('/a/b/c', 'hello.txt')
What’s the equivalent function in Objective-C/cocoa?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is an easier way (well, than messing with subarrays); look in NSPathUtilities.h.
Using the “/a/b/c/hello.txt” example:
And so on…