alphabetize按字母顺序对单词进行排序
按字母顺序排列 按字母顺序 对字符串进行排序。用法:
var alph = require('alphabetize');
console.log(alph('i am a happy string! maybe the happiest?'));
// -> 'a am happiest happy i maybe string the'
或者从命令行使用:
> alphabetize file.txt
# -> a file of test text
> echo 'dogs vs cats' | alphabetize
# -> cats dogs vs
或者在浏览器中使用:
<script src="alphabetize.js">script>
<script>
var txt = document.getElementById('input').value;
var sorted = alph(txt);
document.getElementById('output').innerText = sorted;
script>
下载地址
用户评论