There are a lot of nice little functions in System.IO.Path like replacing a file extension, append to a path, getting a filename, getting a directory from a path in C#. Is there an iOS equivalent or somewhat close API?
thanks!
There are a lot of nice little functions in System.IO.Path like replacing a file extension, append to a path, getting a filename, getting a directory from a path in C#. Is there an iOS equivalent or somewhat close API?
thanks!
Yes, there is. Have a look at "Working with Paths" section in NSString
reference.
To work with actual files you need to use NSFileManager
class
NSString has a number of methods that allow you to manipulate paths.
It's not super elegant, but it's very useful.
NSString *textFile = @"readme.txt"
NSString *markdownFile = [[textFile stringByDeletingPathExtension] stringByAppendingPathExtension:@"markdown"];
// markdownFile is now "readme.markdown"