Tuesday, 11 December 2012

Append string with file extention


NSString *filename = @"DSC004.jpg";//suppose file name this or also file.some.jpg then it also work in the condition
NSString *ext = [filename pathExtension];
NSString *basename = [filename stringByDeletingPathExtension];
NSString *updated = [basename stringByAppendingString:@"-Add"];
NSString *finalName = [updated stringByAppendingPathExtension:ext];

No comments:

Post a Comment