I have a NSMutableDictionary *A (from in.plist). I need to prefix each key in A and in the descendant dictionary of A by a autocremented integer and save the result in a NSMutableDictionary B (saved as out.plist).
What is the best way to achieve this ? Recursivelly ? Loop ? Fastenum ?
PS: We don't know in advance the structure of the dictionary A. It can include dictionary array dictionary ... and so on
Example :
The only diff between the in and out dictionary is the keys name.
I've found a workaround with perl regex directly on the plist file :
cat in.plist | perl -ne 's/<key>/sprintf("<key>%02d -",($INDEX++))/xe;print $_' > out.plist
Works like a charm but a prefer a Objective-c way.