extract folder id from url ios

Try this code:

NSString *url = @"https://apis.live.net/v5.0/folder.1ee916c3057a1eaf.1EE916C3057A1EAF!2204/files/wpid-full-hd-wallpapers-1080p-citimortgage-1.jpg?suppress_response_codes=true&overwrite=false";
NSArray *splitStr = [url componentsSeparatedByString:@"https://stackoverflow.com/"];
NSString *folderId = [splitStr objectAtIndex:4];
NSLog(@"folderId = %@", folderId);

out put: folderId = folder.1ee916c3057a1eaf.1EE916C3057A1EAF!2204

Leave a Comment