- (NSString *)stringWithContentOfFile:encoding:error
ファイルから文字列を生成NSString *str = [NSString stringWithContentOfFile:@"/usr/share/dict/propernames"
encoding:NSUTF8StringEncoding
error:NULL];
if (str) {
NSArray *names = [str componentsSeparatedByString:@"\n"];
for (NSString *s in names) {
NSRange r = [s rangeOfString:@"AA" options:NSCaseInsensitiveSearch];
if (r.location != NSNotFound) {
NSLog(@"%@", s);
}
}
}