要在iPad上保存文件,我需要在以下路径字符串中获取文件名substring(在sites/default/files/
之后):
sites/default/files/243347_TroubleShootingSqlserver20052008.pdf
我该怎么做?
答案 0 :(得分:5)
将路径设置为NSURL *targetURL.
然后
NSString *filename = [[targetURL path] lastPathComponent];
答案 1 :(得分:1)
NSArray* pathURL = [path componentsSeparatedByString: @"/"];
NSString* pdfFileName = [pathURL objectAtIndex: [pathURL length]];