Sort Android strings.xml in Alphabetical Order

前端 未结 3 1095
轻奢々
轻奢々 2021-01-04 10:29

While programming my Android app I just kept inserting elements in strings.xml with no order whatsoever. Is there a shortcut key (like Ctrl+Shift

3条回答
  •  醉酒成梦
    2021-01-04 10:58

    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.

提交回复
热议问题