views:

39

answers:

2

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!

+6  A: 

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

Vladimir
+1  A: 

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"
kubi