如何转换数组,这是一个字典目标-c

时间:2017-04-07 12:19:54

标签: objective-c nsstring nsmutablearray nsdictionary

我的数组

{
    cash = 860;
    flat = 157;
    propertyName = "Four seasons";
},
    {
    cash = 540;
    flat = 156;
    propertyName = "Four seasons";
},
    {
    cash = 560;
    flat = 155;
    propertyName = "Four seasons";
}

如何使用字典

转换另一个数组中具有相同字符串的字典的数组
{
    cash1 = 860;
    cash2 = 540;
    cash3 = 560;
    flat1 = 157;
    flat2 = 156;
    flat3 = 155;
    propertyName = "Four seasons";
}, ...

1 个答案:

答案 0 :(得分:-1)

这可能会帮助你。

仅供参考,这简单得多......

(define rdup
  (lambda (l)
   (reverse (let loop ((lst l)
               (c '()))
      (cond
        ((null? lst) c)
        (else
         (if (member (car lst) c)
             (loop (cdr lst) c)
             (loop (cdr lst) (cons (car lst) c)))))))))