[code]int main(int argc, const char * argv[])
{
@autoreleasepool {
// Read in a file as a huge string (ignoring the possibility of an error)
NSString *wordString =
[NSString stringWithContentsOfFile:@"/usr/share/dict/words"
encoding:NSUTF8StringEncoding
error:NULL];
NSArray *words = [wordString componentsSeparatedByString:@"/n"];
NSString *nameString =
[NSString stringWithContentsOfFile:@"/usr/share/dict/propernames"
encoding:NSUTF8StringEncoding
error:NULL];
NSArray *names = [nameString componentsSeparatedByString:@"/n"];
for (NSString *n in names) {
NSString *nlc = [n lowercaseString];
for (NSString *w in words){
if ([nlc isEqualToString:w]) {
NSLog(@"%@ is both a name and a word", nlc);
}
}
}
}
return 0;
}
[/code]
It is building fine but returning nothing. Also Hi just bought the book and first post on the forum. Im crazy excited to take the plunge with Obj C!