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


_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to