Comparing keys in a dictionary
Comparing keys in a dictionary
- Subject: Comparing keys in a dictionary
- From: Reuss <email@hidden>
- Date: Fri, 9 Nov 2001 10:06:59 +0100
Hi everybody,
I stumble over a certainly trivial problem:
I have a dictionary in a file with the following structure:
<dict>
<key>ArrayItem_1</key>
<dict>
<key>Circumference</key>
<string>2</string>
</dict>
<key>ArrayItem_2</key>
<dict>
<key>Circumference</key>
<string>3</string>
</dict>
<key>Class</key>
<string>MyDocument</string>
<key>Version</key>
<string>1</string>
</dict>
When reading this file into memory, I would like to read only the
Array_Items into a tableView. So I tried to get the keys and check
whether the string "ArrayItem_" is contained. But this doesn't work,
at least in the following form:
NSEnumerator *enumerator = [dictionary keyEnumerator];
NSString *key;
while ((key = [enumerator nextObject])) {
if (0 != [key rangeOfString:@"ArrayItem_"]){
[tableViewItemArray addObject:[dictionary objectForKey:key]];
}
}
Could you give me a hint what's wrong or where to read to find more
information, please ?
Thank you very much.
Tom
--
_________________________________________________________________
Thomas REUSS
http://reusst.free.fr
_________________________________________________________________