Sort Android strings.xml in Alphabetical Order

◇◆丶佛笑我妖孽 提交于 2019-11-30 17:48:47

For anyone else who bumps into this. Copy all the string elements, paste into an Excel spreadsheet sort A-Z and then copy and paste back.

This is actually a feature in ADT plugin:

However, it only sort elements in Resources viewer, it doe not modify anything in the original strings.xml file.

For those who have access to GNU or similar *nix command-line utils, you can do the following:

cat <(head -n 1 strings.xml) <(head strings.xml -n -2 | tail -n +2 | sort ) <(tail -n 2 strings.xml)

You may need to tweak the numbers slightly if your strings.xml has a larger XML header.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!