Breaking News
Home / iOS / ObjectiveC / How to get the filename with extension from a Path in Objective C?

How to get the filename with extension from a Path in Objective C?

Answer

To get the filename with extension from a given path do the following:

NSString *thePath = @”/tmp/test/result.log”;

NSString *fname = [thePath lastPathComponent];

// result in fname = result.log

[pb_builder]

Check Also

Singleton Example in Objective C?

Solution static MyManager *sharedManager = nil; +(MyManager*) sharedManager {         if (sharedManager == nil)         …

Advertisment ad adsense adlogger