项目

一般

简介

行为

sortList

数组元素排序

标签:命令定义|sortList>sortList

格式
命令名 参数1 参数2 参数3 参数4
sortList 原始数组 返回数组 排序方向 排序类型
说明
  • 参数1:原始数组
  • 参数2:排序后返回的数组
  • 参数3:排序方向
    缺省或0 升序方向
    1 降序方向
  • 参数4:排序类型
    缺省或0 数值排序
    1 文本排序


特戒引擎脚本示例:

[@main]
#if
#act
mov L$测试 [11,22,33,44,55,66,77,88]
;--参数3 0或缺省升序,1降序;参数4 0或缺省数值排序,1文本排序
sortList L$测试 L$测试2 1 0
print 【元素排序10】<$str(L$测试2)>

sortList L$测试 L$测试2 0 0
print 【元素排序00】<$str(L$测试2)>

mov L$测试 [aa,cc,dd,bb,ee,ff]
sortList L$测试 L$测试2 0 1
print 【元素排序01】<$str(L$测试2)>

sortList L$测试 L$测试2 1 1
print 【元素排序11】<$str(L$测试2)>

mov L$测试 [11,22,33,44,55,66,77,aa]
sortList L$测试 L$测试2 1 0
;--数字排序,如有字符元素,输出[error]
print 【元素排序err】<$str(L$测试2)>

tejie 更新于 3 个月 之前 · 1 修订