求助数组依次分别组合
#include <Array.au3>Dim $a=['a','b']
Dim $b=
Dim $c=['!','@','#']
_ArrayDisplay($a) heavenm 发表于 2018-8-8 20:04
#include
;首输入
Dim $aVarA = ['a', 'b', 'c']
这就对了,{:face (197):}
#include <array.au3>
;首输入
Dim $aVarA = ['a', 'b', 'c']
Dim $aVarB =
Local $aArray = _ArrayCombinationsX($aVarA, $aVarB)
_ArrayDisplay($aArray)
;再来
Dim $aVarC = ['!', '@', '#']
$aArray = _ArrayCombinationsX($aArray, $aVarC)
_ArrayDisplay($aArray)
Func _ArrayCombinationsX($avA1, $avA2)
If Not IsArray($avA1) Or Not IsArray($avA2) Then Return SetError(1)
Local $aRe = , $element
For $i = 0 To UBound($avA1) - 1
For $j = 0 To UBound($avA2) - 1
$element = $avA1[$i] & $avA2[$j]
_ArrayAdd($aRe, $element)
Next
Next
_ArrayDelete($aRe, 0)
Return $aRe
EndFunc ;==>_ArrayCombinationsX
怎么组合成
a,1,!
a,1,@
a,1,#
a,2,!
1,2,@
..........
一直组合到完结
数组数量不确定,有可能$A-$Z #include <array.au3>
;首输入
Dim $aVarA = ['a', 'b', 'c']
Dim $aVarB =
Local $aArray = _ArrayCombinationsX($aVarA, $aVarB)
_ArrayDisplay($aArray)
;再来
Dim $aVarC = ['!','@', '#']
$aArray = _ArrayCombinationsX($aArray, $aVarC)
_ArrayDisplay($aArray)
Func _ArrayCombinationsX($avA1, $avA2)
If Not IsArray($avA1) Or Not IsArray($avA2) Then Return SetError(1)
Local $aRe = , $element
For $i = 0 To UBound($avA1) - 1
For $j = 0 To UBound($avA2) - 1
$element = $avA1[$i] & $avA2[$j]
_ArrayAdd($aRe, $element)
Next
Next
_ArrayDelete($aRe, 0)
Return $aRe
EndFunc
http://autoitx.com/thread-46338-2-1.html
这个好像有点像,不过最后的数据好像不太对,再研究研究 #include <array.au3>
;首输入
Dim $aVarA = ['a', 'b', 'c']
Dim $aVarB =
Dim $aVarC = ['!', '@', '#']
Dim $aVarD = ['$', '%', '^']
Dim $aVarE = ['&', '*', '(']
Dim $arrar = [$aVarA, $aVarB, $aVarC, $aVarD, $aVarE]
$count = UBound($arrar)
Select
Case $count == 1
$combinations = $arrar
Case $count == 2
$combinations = _ArrayCombinationsX($arrar, $arrar)
Case $count >= 3
$combinations = _ArrayCombinationsX($arrar, $arrar)
For $i = 2 To $count - 1
$combinations = _ArrayCombinationsX($combinations, $arrar[$i])
Next
EndSelect
_ArrayDisplay($combinations)
Func _ArrayCombinationsX($avA1, $avA2)
If Not IsArray($avA1) Or Not IsArray($avA2) Then Return SetError(1)
Local $aRe = , $element
For $i = 0 To UBound($avA1) - 1
For $j = 0 To UBound($avA2) - 1
$element = $avA1[$i] & $avA2[$j]
_ArrayAdd($aRe, $element)
Next
Next
_ArrayDelete($aRe, 0)
Return $aRe
EndFunc ;==>_ArrayCombinationsX
N组数组组合
页:
[1]