-
Notifications
You must be signed in to change notification settings - Fork 0
Sort
uupaa edited this page Apr 22, 2015
·
6 revisions
var Sort = {
"nat": Sort_nat, // Sort.nat(source:StringArray, ignoreCase:Boolean = false):StringArray
"number": Sort_number, // Sort.number(source:NumberArray):NumberArray
"random": Sort_random, // Sort.random(source:Array):Array
};
Sort.nat(source:StringArray, ignoreCase:Boolean = false):StringArray は、文字列を人間からみて自然な順番にソートします。
var source = ["document", "document new", "document 2013-12-31", "document new new", "document 2013-12-31 new"];
var sorted = Sort.nat(source); // ["document", "document new", "document new new", "document 2013-12-31", "document 2013-12-31 new"]
Sort.number(source:NumberArray):NumberArray は、source を昇順にソートします。
Sort.number([3, 1, 2]) // [1, 2, 3]
Sort.random(source:Array):Array は、source をランダムソートします。