Thread-topic: Way of removing by value from CFMutableArray
User-agent: Microsoft-Entourage/11.2.0.050811
On Fri, 30 Sep 2005 16:12:06 +0530, "Ayyapu Reddy Pallam"
<email@hidden> wrote:
> I have list of indices of values of CFMutableArray. If i try to remove the
values from the array looping throgh the indices array using
CFArrayRemoveValueAtIndex() indices may not be valid after the first removal(it
decrements indices). So do we have some function like CFArrayRemoveObject() or
CFArrayRemoveValue() where i can pass the value to be removed from the CFArray.
Or any other way of removing by value from CFMutableArray.
If you loop backwards then you won't be trying to remove the wrong indices:
CFIndex idx;
for (idx = CFArrayGetCount(tCFMutableArrayRef); idx > 0; idx--) {
CFStringRef myValue = (CFStringRef)
CFArrayGetValueAtIndex(tCFMutableArrayRef, idx);
if (kCFCompareEqualTo ==
CFStringCompare(myValue, CFSTR("FooBar"), 0))
{
CFArrayRemoveValueAtIndex(tCFMutableArrayRef, idx);
}
}
--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden