ios 获取文件扩展名备忘

时间:2021-09-03 09:29:33

NSString *lastComponent = [cachePath lastPathComponent];  
            NSString *pathLessFilename = [cachePath stringByDeletingLastPathComponent];  
            NSString *originalPath = [pathLessFilename stringByAppendingPathComponent: lastComponent]; 
            NSString *pathExtension = [[cachePath pathExtension] lowercaseString]; 
            
            NSLog(@"%@", lastComponent);
            NSLog(@"%@", pathLessFilename);
            NSLog(@"%@", originalPath);
            NSLog(@"%@", pathExtension);