对NSString的操作不熟悉,目前采用以下方法取得路径中的文件名以及文件夹路径
NSString* test=[[NSString alloc]initWithFormat:@"D:\compile\20140523155024344.EC0"]; NSArray *array = [test componentsSeparatedByString:@"\"]; NSLog(@"filename is %@",[array objectAtIndex:array.count-1]); NSLog(@"path is %@",[test stringByReplacingOccurrencesOfString:[array objectAtIndex:array.count-1] withString:@""]);
方法很笨,大家见谅,有好的也可以留言,谢谢