有一个简单的方法来排序plist(字典数组)的键值? [英] Is there an easy way of sorting a plist (array of dictionaries) by key value?

查看:188
本文介绍了有一个简单的方法来排序plist(字典数组)的键值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过Key值重新排序plist(一个数字数组)。

I need to reorder a plist (an array of dictonaries) by Key value.

在这个例子中,我想按键值名称(Matt,Joe):

In this example content I'd like to order by the value for the key Name (Matt, Joe):

<dict>
    <key>Name</key>
    <string>Matt</string>
    <key>Details</key>
    <string>Me</string>
</dict>
<dict>
    <key>Name</key>
    <string>Joe</string>
    <key>Details</key>
    <string>You</string>
</dict>

有简单的方法吗?

任何想法?

很高兴使用任何工具来完成这项工作:在命令行上使用ninja参数,plist编辑器,文本编辑器等。

Happy to use any tool to get this done: ninja parameters for sort on the command line, a plist editor, text editor or whatever.

推荐答案

我最后写了一个五行PHP脚本重新排序。我想我还有很多Cocoa在学习之前,可以做一些快速,舒适的事情。

I ended up writing a five line PHP script to reorder them. I guess I still have a lot of Cocoa to learn before I can do something that quickly and comfortably with it.

感谢您的回答。

这篇关于有一个简单的方法来排序plist(字典数组)的键值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆