Dosen't make sense


OK so I completed the second challenge

        // Read in the names
        NSString *nameString = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames"
        // Read in the words
        NSString *wordString = [NSString stringWithContentsOfFile:@"/usr/share/dict/words"
        // Make the array of names
        NSArray *names = [nameString componentsSeparatedByString:@"\n"];
        // Make the array of words
        NSArray *words = [wordString componentsSeparatedByString:@"\n"];
        // Nested Loops that compare each name agains each word
        for (NSString *n in names) {
            for (NSString *w in words) {
                if([n caseInsensitiveCompare:w] == NSOrderedSame) {
                    NSLog(@"%@ and %@ are the same.", n, w);

This is pretty much what most people have and seems to be the correct way to do it. However what Im confused about is the result. Its meant to find proper common names that are also regular words i.e Glen and glen. But the results seem far from what is expected. Heres a snippet:
2012-02-05 21:03:29.537 NameCompare[2377:707] Aaron and Aaron are the same.
2012-02-05 21:03:29.558 NameCompare[2377:707] Adam and Adam are the same.
2012-02-05 21:03:29.578 NameCompare[2377:707] Adlai and Adlai are the same.
2012-02-05 21:03:29.598 NameCompare[2377:707] Adrian and Adrian are the same.
2012-02-05 21:03:29.619 NameCompare[2377:707] Agatha and Agatha are the same.
2012-02-05 21:03:29.648 NameCompare[2377:707] Ahmed and Ahmed are the same.
2012-02-05 21:03:29.682 NameCompare[2377:707] Ahmet and Ahmet are the same.
2012-02-05 21:03:29.704 NameCompare[2377:707] Aimee and Aimee are the same.
2012-02-05 21:03:29.725 NameCompare[2377:707] Al and Al are the same.
2012-02-05 21:03:29.725 NameCompare[2377:707] Al and al are the same.

These just seem to be all names and not names that are also words.



/usr/share/dict/words includes proper names, which I assume is a recent development; in any case, what you’re seeing is expected.


Ok thanks :slight_smile: just thought it was a bit strange…