discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with Replacing a String is a NSMutableString


From: David Ayers
Subject: Re: Problems with Replacing a String is a NSMutableString
Date: Thu, 24 Jul 2008 09:11:58 +0200
User-agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509)

Hello Charles,

Charles philip Chan schrieb:

> I am currently having a problem with replacing a string in an
> NSMutableString and I am not too sure whether it is a bug in the current
> SVN tree or I am doing something stupid. Here are the code snippets:
> ...
> NSMutableString *albumIndexTemp;
> ...
> // PlayItem is just a dictionary of strings. Since there is
> // only 1 key with the value of "Album". The first index of
> // the array should return something like 
> // "ID_CLIP_INFO_NAME4".
> albumIndexTemp = [[playingItem allKeysForObject:@"Album"] 
>                objectAtIndex: 0]; 
> 
> // This should return something like "ID_CLIP_INFO_VALUE4"
> [albumIndexTemp replaceOccurrencesOfString:@"NAME" 
>                 withString:@"VALUE"];

> 
> What am I doing wrong?

I would assume that if playingItem is an NS[(Mutable)Dictionary that the
key returned by allKeysForObject: are immutable.  Keys for collections
are copied by the collection to insure they are immutable.  Allowing
them to be mutable would break the internal hash lookups.

Cheers,
David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]