Breaking News
Home / iOS / ObjectiveC / How to get the filename without extension in Objective C?

How to get the filename without extension in Objective C?

Answer

To get  just the  filename without the extension do the following:

NSString *inputStr = @”/opt/app/license.txt”;

NSString* fname = [[inputStr lastPathComponent] stringByDeletingPathExtension];

// results in fname = license

[pb_builder]

Check Also

Singleton Example in Objective C?

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

Advertisment ad adsense adlogger