Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trim file extension UITableView

I want to trim the file extension from text I have an NSMutableArray in table cells.

NSMutableArray *theFiles = [NSMutableArray new];
NSFileManager *manager = [NSFileManager defaultManager];
NSArray *fileList = [manager directoryContentsAtPath:@"/Test"];
for (NSString *s in fileList){
    [theFiles addObject:fileList];
}
cell.textLabel.text = theFiles[indexPath.row];
return cell;

This lists for example "Xylophone.m4r" I want to remove the .m4r.

like image 313
WrightsCS Avatar asked Nov 16 '09 06:11

WrightsCS


1 Answers

Try -[NSString stringByDeletingPathExtension] (in NSPathUtilities.h).

like image 57
Nicholas Riley Avatar answered Sep 20 '22 04:09

Nicholas Riley