Foxtable(狐表)用户栏目专家坐堂 → 请教袍大师


  共有2457人关注过本帖树形打印复制链接

主题:请教袍大师

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/26 11:32:00 [显示全部帖子]

mark 组合排列

 

内部函数 loop

 

Dim a() As String = args(0)
Dim n As Integer = args(1)
Dim m As Integer = args(2)
Dim b() As String = args(3)
Dim Mm As Integer = args(4)

For i As Integer = n To m Step -1
    b(m-1) = i-1
    If m > 1 Then
        Functions.Execute("loop", a, i-1, m-1, b, Mm)
    Else
        Dim result As String = ""
        For j As Integer = Mm - 1 To 0 Step -1
            result &= a(b(j)) & "|"
        Next
        output.show(result.Trim("|"))
    End If
Next

 

调用

 

Dim a() As String = {"a", "b", "c", "d"}
Dim b(a.length-1) As String

'n -> 元素个数
'm -> 选取多少个元素
'Mn -> 层级
For i As Integer = 1 To 4
Functions.Execute("loop", a, a.length, i, b, i)
Next


 回到顶部