Created
December 19, 2021 14:49
-
-
Save ichitaso/39d17c47d97adafd9abc58d67b1b4c77 to your computer and use it in GitHub Desktop.
NSArrayのarrayをNSRangeのrangeOfString:を使わないで複数フィルタリング(簡易)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PREF_PATH @"/private/var/mobile/Library/Preferences" | |
void filterPath() { | |
NSFileManager *fileManager = [[NSFileManager alloc] init]; | |
NSArray *allFileName = [fileManager contentsOfDirectoryAtPath:PREF_PATH error:nil]; | |
NSArray *filterFile = @[@".GlobalPreferences.plist", | |
@"TVRemoteConnectionService.plist", | |
@"UITextInputContextIdentifiers.plist", | |
@"nfcd.plist", | |
@"com.google.gmp.measurement.plist", | |
@"com.google.gmp.measurement.monitor.plist"]; | |
NSMutableArray *hitFileNames = [NSMutableArray array]; | |
for (NSString *fileName in allFileName) { | |
NSRange range = [fileName rangeOfString:@"com.apple."]; | |
if (range.location == NSNotFound && ![filterFile containsObject:fileName]) { // <- ここ | |
NSString *fileNamePath = [NSString stringWithFormat:@"%@/%@",PREF_PATH, fileName]; | |
[hitFileNames addObject:fileNamePath]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment