I have an NSDictionary as follows (keys + array as object):

{
aKey = (
        anObject
);
otherKey = (
        "other Object",
        "third Object",
        "second Object"
);
}

I have a method too:

- (NSMutableDictionary *) findStringInKeys: (NSString *) aString
        {
        unsigned int counter;
        unsigned int i;
        NSRange myRange;

        NSArray *records = [myDict allKeys];
        NSMutableDictionary *match = [NSMutableDictionary new]; 
        counter = [records count];
        for (i=0; i<counter; i++)
                {
                myRange = [[records objectAtIndex:i] rangeOfString: aString];
                         if (myRange.length != 0)
                        {
                        NSLog (@"%@", [myDict objectForKey: [records objectAtIndex: 
i]]);
                        }
                }
        return match;
}

If I convoque my method in main.m as follows:
[myDico findStringInKeys: @"aKey"];

I get
Jul 01 11:53:18 dix[2122] ("anObject","anObject")
or
[myDico findStringInKeys: @"otherKey"];
Jul 01 11:53:18 dix[2122] ("other Object","third Object", "second Object", "other 
Object","third Object", "second Object" )

As I can see, every arraymembers are duplicated (with -count, i got two
for an array of 1 member), but I don't see why. Is
it normal?

What is wrong?
thanks in advance
_______________________________________________
Help-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-gnustep

Reply via email to